cobbler 目前最新版本爲2.6.9 官網爲http://cobbler.github.io/
一,安裝cobbler
以下是相關配置路徑(默認安裝) :
Cobbler 配置主要位置:/var/lib/cobbler/ (實際操作和配置的目錄 )
snippets 代碼 位置:/var/lib/cobbler/snippets/
Kickstart 模板 位置 : /var/lib/cobbler/kickstarts/
安裝源鏡像 位置 : /var/www/cobbler/ks_mirror/ (把它link到apache的發佈目錄,方便kickstart 工作時通過http下載安裝鏡像文件 )
yum install cobbler cobbler-web pykickstart debmirror -y
二,解決cobbler初始化問題
[root@cobbler yum.repos.d]#cobbler check
The following are potential configuration items that you may want to fix:
1 : The 'server' field in /etc/cobbler/settings must be set to something other than localhost, or kickstarting features will not work. This should be a resolvable hostname or IP for the boot server as reachable by all machines that will use it.
2 : For PXE to be functional, the 'next_server' field in /etc/cobbler/settings must be set to something other than 127.0.0.1, and should match the IP of the boot server on the PXE network.
3 : SELinux is enabled. Please review the following wiki page for details on ensuring cobbler works correctly in your SELinux environment:
https://github.com/cobbler/cobbler/wiki/Selinux
4 : some network boot-loaders are missing from /var/lib/cobbler/loaders, you may run 'cobbler get-loaders' to download them, or, if you only want to handle x86/x86_64 netbooting, you may ensure that you have installed a *recent* version of the syslinux package installed and can ignore this message entirely. Files in this directory, should you want to support all architectures, should include pxelinux.0, menu.c32, elilo.efi, and yaboot. The 'cobbler get-loaders' command is the easiest way to resolve these requirements.
5 : change 'disable' to 'no' in /etc/xinetd.d/rsync
6 : comment out 'dists' on /etc/debmirror.conf for proper debian support
7 : comment out 'arches' on /etc/debmirror.conf for proper debian support
8 : The default password used by the sample templates for newly installed machines (default_password_crypted in /etc/cobbler/settings) is still set to 'cobbler' and should be changed, try: "openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'" to generate new one
9 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them
Restart cobblerd and then run 'cobbler sync' to apply changes.
在/etc/cobbler/settings裏配置server的地址
在/etc/cobbler/settings裏配置next_server的地址
修改SELinux的配置文件vim /etc/selinux/config 爲disabled
執行cobbler get-loaders
change 'disable' to 'no' in /etc/xinetd.d/rsync
註釋/etc/debmirror.conf中的dists行
註釋/etc/debmirror.conf中的arches行
執行以下命令加密密碼並替換/etc/cobbler/settings的default_password_crypted
[root@cobbler ~]# openssl passwd -1 -salt 'random-phrase-here' 'jiayuan.com'
$1$random-p$CiZoWfdQPZ.Hcyd/MxC/31
安裝cman 和 fence-agents
三,安裝並管理所需服務
yum -y install dhcp tftp rsync xinetd
四,啓動web界面
要想啓動web界面,就必須要先啓動httpd,啓動後如下:
四,導入系統鏡像
首先掛載系統鏡像,然後執行令導入系統鏡像。
mount -o loop /var/iso/CentOS-6.4-x86_64.iso /mnt/os/ cobbler import --path=/mnt/os/ --name=centos6.4 --arch=x86_64
注意: 這個安裝源的唯一標示 就是根據這兩個參數來定義name,arch.導入系統後查看
cobbler distro list cobbler profile find --distro=*** #查看配置文件是否存在 cobbler profile remove --name=*** #刪除配置文件 cobbler profile find --distro=*** #再查看配置已無 cobbler distro remove --name=**** #刪除distro
五、自定義profile
cobbler profile add --name=centos6.3-x86_64 --distro=rhel6.3-x86_64 --kickstart=/var/lib/cobbler/kickstarts/6u33w.ks
參數說明:
--name Profile的名字 ( 同樣也不能重複 ),在此例中,我們新定義的Profile 叫:6u33w.ks
--distro Profile相關聯的安裝源ID(通過 cobbler distro list 可查到)
--kickstart Profile相關聯的kickstart配置文件 (此文件必須預先準備好 )
查看profile
cobbler profile report --name centos6.3-x86_64 ksfile=$( cobbler profile report --name centos6.3-x86_64|grep -E '^Kickstart' |head -n 1|cut -d ':' -f 2 );cat $ksfile;