Cobbler

Install

lsb_release  -a
LSB Version:    :core-4.0-amd64:core-4.0-ia32:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-ia32:printing-4.0-noarch
Distributor ID:    CentOS
Description:    CentOS release 5.8 (Final)
Release:    5.8
Codename:    Final
 
yum install cobbler.noarch cobbler-web.noarch tftp dhcp-y
※cobbler 2.2.3-2

Setting

#vi /etc/cobbler/settings
161: manage_dhcp: 1
362: server: your_server_ip

apache再起動エラー

service httpd start
启动 httpd:Syntax error on line 10 of /etc/httpd/conf.d/cobbler.conf:
Invalid command 'WSGIScriptAliasMatch', perhaps misspelled or defined by a module not included in the server configuration
vi /etc/httpd/conf.d/wsgi.conf ,
#LoadModule wsgi_module modules/mod_wsgi.so
LoadModule wsgi_module modules/mod_wsgi.so
cobbler check

dhcp.template

# more dhcp.template
# ******************************************************************
# Cobbler managed dhcpd.conf file
#
# generated from cobbler dhcp.conf template ($date)
# Do NOT make changes to /etc/dhcpd.conf. Instead, make your changes
# in /etc/cobbler/dhcp.template, as /etc/dhcpd.conf will be
# overwritten.
#
# ******************************************************************
 
ddns-update-style interim;
 
allow booting;
allow bootp;
#if $omapi_enabled
omapi-port $omapi_port;
#end if
 
ignore client-updates;
set vendorclass = option vendor-class-identifier;
 
#
# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp*/dhcpd.conf.sample
#
 
ddns-update-style interim;
 
allow booting;
allow bootp;
 
ignore client-updates;
set vendorclass = option vendor-class-identifier;
 
subnet 192.168.0.0 netmask 255.255.0.0 {
     option routers             192.168.0.1;
     option domain-name-servers 192.168.0.1;
     option domain-name         "yepn.net";
     option subnet-mask         255.255.0.0;
     range dynamic-bootp        192.168.0.201 192.168.0.254;
     filename                   "/pxelinux.0";
     default-lease-time         21600;
     max-lease-time             43200;
     next-server                $next_server;
}

IOS file import

Here follows an example of a Cobbler setup for provisioning Centos 5 with x86 architecture, using the most known extra repositories and some sample public mirror. The same procedure can be easily adapted to other Centos versions or architectures, changing the specified urls and arch options. You need at least 5Gb of space in /var/www/cobbler for importing the official DVD and not less that 30Gb of space for mirroring the additional repositories.

1 - Initial import from a Centos DVD. Place the DVD in your CD drive:

mount -t auto /dev/hdc /media/cdrom (if not autmounted)
cobbler import --mirror=/media/cdrom --name=Centos5 --arch=x86

If you have an ISO, you can import directly from it:

mount -t auto -o loop  /path/to/file.iso /mnt/
cobbler import --mirror=/mnt --name=Centos5 --arch=x86
umount /mnt

After this import, that can last some minutes, the iso or DVD is no longer necessary for cobbler: all its files are copied.

2- Sync and show what has been done: you should hve 2 distros and 2 profiles for normal and xen Centos provisioning.

cobbler sync
cobbler list
distro Centos5-x86
     profile Centos5-x86
distro Centos5-xen-x86
     profile Centos5-xen-x86

2-1

cobbler profile add --name=任意 --distro=ディストリビューション名 --kickstart=<ks_fileのパス>
ディストリビューション名はcobbler report を実行した際のdistro項目を参照する
nameは分かりやすい任意の名前にする
キックスタートでそれぞれ実行する。
 
※ /var/lib/cobbler/kickstartsにキックスタート設定ファイル by default

3- Add extra repositories from sample mirrors (find a list of official mirrors on Centos site) Updates:

cobbler repo add --name=Centos5-UPDATES --mirror=ftp://ftp.sunet.se/pub/Linux/distributions/centos/5/updates/i386/ --priority=40 --createrepo-flags="-c cache" --arch=x86

CentosPlus:

cobbler repo add --name=Centos5-CENTOSPLUS --mirror=ftp://ftp.sunet.se/pub/Linux/distributions/centos/5/centosplus/i386/ --priority=40 --createrepo-flags="-c cache" --arch=x86

Extras:

cobbler repo add --name=Centos5-EXTRAS --mirror=ftp://ftp.sunet.se/pub/Linux/distributions/centos/5/extras/i386/ --priority=40 --createrepo-flags="-c cache" --arch=x86

EPEL:

cobbler repo add --name=Centos5-EPEL --mirror=http://www.mirrorservice.org/sites/download.fedora.redhat.com/pub/epel/5/i386/ --priority=50 --createrepo-flags="-c cache"

RPMFORGE (Dag and Others):

cobbler repo add --name=Centos5-RPMFORGE --mirror=http://apt.sw.be/redhat/el5/en/i386/dag/ --priority=90 --createrepo-flags="-c cache"

Note that EPEL and RPMFORGE may have problems when used at the same time. The use of priorities should solve most of them. If you want to use both, decide which one has to be selected first (lower priority) in case of conflicting packages.

4- Mirror your mirrors

cobbler sync   #(syncs the newly added repos)
cobbler reposync   #(makes a local mirror or the defined mirrors, requires Internet connection and may take a lot of time, especially at the first run).

It's a good practice to make a daily cron run of “cobbler reposync” in order to have your mirrors automatically updated.

导入Centos6.4 第二张DVD

Tip: Importing multiple CentOS Linux DVDs into Cobbler Linux distributions are getting larger and larger; CentOS 6.0 64-bit won’t fit on a single DVD anymore. A Cobbler-based provisioning server will normally import only one DVD. So, how do you get around this?

Import the first DVD as usual Manually add content from the second DVD Import the first DVD (ISO image):

  mkdir /mnt/dvd1; mount -o ro,loop /tmp/CentOS-6.0-x86_64-bin-DVD1.iso /mnt/dvd1

  DISTRO=centos60-x86_64
  cobbler import --name=${DISTRO} --path=/mnt/dvd1

Watch the output from Cobbler closely – it will basically tell show you the commands you need to import the second DVD

Import the second DVD (ISO image):

  mkdir /mnt/dvd2; mount -o ro,loop /tmp/CentOS-6.0-x86_64-bin-DVD2.iso /mnt/dvd2

  rsync -a  '/mnt/dvd2/' /var/www/cobbler/ks_mirror/${DISTRO} --exclude-from=/etc/cobbler/rsync.exclude --progress
  COMPSXML=$(ls /var/www/cobbler/ks_mirror/${DISTRO}/repodata/*comps*.xml)
  createrepo -c cache -s sha --update --groupfile ${COMPSXML} /var/www/cobbler/ks_mirror/${DISTRO}

Done! You have now added the contents of the second DVD to your existing “ks_mirror” directory and updated the Yum repodata.

常用命令

导入ISO文件

非标准linux系统
mount -t auto -o loop  /path/to/CentOS-6.1-minimal-x86_64.iso /mnt/
cobbler distro add --name=Centos-6.1-minimal-x86_64 --kernel=/mnt/isolinux/vmlinuz --initrd=/mnt/isolinux/initrd.img

标准linux系统导入方法

cobbler import --path=/mnt --name=CentOS-6.1-minimal-x86_64

add 日本 repo

#cobbler repo add -name="Centos5.x-x86_64-epel" --mirror=http://ftp.riken.jp/Linux/fedora/epel/5/x86_64/
#cobbler repo add -name="Centos6.x-x86_64-epel" --mirror=http://ftp.riken.jp/Linux/fedora/epel/6/x86_64/

CentOS6.x kickstart例

# Kickstart file automatically generated by anaconda.
 
#version=DEVEL
text
install
#url --url=http://ftp.riken.jp/Linux/scientific/6.1/x86_64/os
url --url=http://cobbler.mobcon.inside/cobbler/ks_mirror/CentOS-6.1-x86_64/
 
lang en_US.UTF-8
keyboard jp106
network --onboot yes --device eth1 --bootproto dhcp --noipv6
rootpw  --iscrypted $6$Ykz4bOipJbF1cSqA$NY0wMFMwYrQpywSnczC54BRshEW6E6dkvAwaKXxt4eYNF5qBLXnH6m22aLTZerX4jzC501XeXV3qfmm6vXbAX0
authconfig --enableshadow --passalgo=sha512
firewall --disabled
selinux --disabled
timezone --utc Asia/Tokyo
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
clearpart --all
part /boot --fstype ext4 --size=100
part swap --size=8192
part / --fstype ext4 --size=1 --grow
reboot
 
repo --name="Centos Linux"  --baseurl=http://ftp.riken.jp/Linux/centos/6.1/os/x86_64 --cost=100
#repo --name="EPEL-6-x86_64" --baseurl=http://download.fedora.redhat.com/pub/epel/6/x86_64 --cost=100
 
services --enabled ipmi
services --disabled yum-updatesd, cups, kudzu, gpm, smartd, xfs, sendmail, netfs, nfs, nfslock, portmap, bluetooth
#↑位置很重要
 
%packages
@base
@console-internet
@core
@debugging
@directory-client
@hardware-monitoring
@japanese-support
@large-systems
@network-file-system-client
@performance
@perl-runtime
@system-management-snmp
@scalable-file-systems
@server-platform
@system-management
@system-admin-tools
pax
oddjob
sgpio
certmonger
pam_krb5
krb5-workstation
perl-DBD-SQLite
git
ipmitool
OpenIPMI
OpenIPMI-devel
OpenIPMI-libs
OpenIPMI-perl
OpenIPMI-python
ruby
ruby-devel
ruby-libs
ruby-augeas
facter
func
pigz
tree
%end
 
%post --log=/root/ks-post.log
service ipmi start
wget -O- http://cobbler.mobcon.inside/scripts/ipsetting.sh|bash
 
rpm -i http://cobbler.mobcon.inside/scripts/epel-release-6-5.noarch.rpm
rpm --import http://cobbler.mobcon.inside/scripts/RPM-GPG-KEY-ZABBIX-JP
rpm -i http://cobbler.mobcon.inside/scripts/zabbix-jp-release-6-4.noarch.rpm
rpm -i http://cobbler.mobcon.inside/scripts/puppet-2.7.1-1.x86_64.rpm
puppet agent --mkusers
chkconfig puppet on

Cobbler&ipmi

cobblerとipmi連携

#ipmitool -I lanplus -H 172.24.6.47 -U root -P 3ta9rooz chassis bootdev pxe
 
#Set Boot Device to pxe
ipmitool -I lanplus -H 172.24.6.47 -U root -P 3ta9rooz chassis power reset

Cobbler error

http访问时,到svc目录时,提示 no mode specified
ks文件中使用shell脚本时,变量要用\转义,防止python解析。
用cobbler validateks时能看到错误。

OS reinstall

koan --server=puppet --list=profiles
 
- looking for Cobbler at http://puppet:80/cobbler_api
Centos-5.4-bin-DVD-x86_64
Centos-5.4-bin-DVD-x86_64-xfs
Centos-6.3-bin-DVD-x86_64
Centos-5.7-bin-DVD-x86_64
Centos-5.7-bin-DVD-x86_64-xfs
Centos-5.8-bin-DVD-x86_64
Centos-5.7-bin-DVD-x86_64-fio2
 
koan --server=puppet --profile=Centos-5.7-bin-DVD-x86_64 --replace-self
 
reboot
/var/lib/openshift/bccd8eac1968476490eaee9ced33c7bf/app-root/runtime/repo/php/data/pages/cobbler.txt · 最后更改: 2013/05/11 16:05 由 admin
到顶部
CC Attribution-Noncommercial-Share Alike 3.0 Unported
chimeric.de = chi`s home Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0