1、安裝 cobbler
1.1、安裝前的準(zhǔn)備
- 安裝epel源,在centos下,直接執(zhí)行
]# yum install epel-release
- 安裝 cobbler 所需的配合軟件:DHCP、TFTP、Apache
注:
cobbler 支持管理兩種DHCP,ISC DHCP 和 dnsmasq ,通過以下命令,默認(rèn)安裝的是 ISC DHCP
]# yum install dhcp tftp-server httpd
- 安裝cobbler
]# yum install cobbler
注1:
實驗機(jī)的配置請參考《VMware --- CentOS6.x 實驗機(jī)的安裝配置》
注2:
實驗機(jī)所使用的操作系統(tǒng)版本為:CentOS release 6.6 (Final)
注3:
實驗機(jī)本機(jī) IP 為:192.168.80.20
2、配置 cobbler
2.1 執(zhí)行 cobbler check
- 啟動 cobbler 和 http
]# /etc/init.d/cobblerd start
]# /etc/init.d/httpd start
]# chkconfig cobblerd on
]# chkconfig httpd on
- 開啟 cobbler 的動態(tài)配置
]# cp /etc/cobbler/settings /etc/cobbler/settings.`date +%y%m%d`.bak
]# vim /etc/cobbler/settings
allow_dynamic_settings: 0 --> 1
]# /etc/init.d/cobblerd restart
- 檢查 cobbler 安裝
]# 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 : change 'disable' to 'no' in /etc/xinetd.d/tftp
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 : debmirror package is not installed, it will be required to manage debian deployments and repositories
7 : ksvalidator was not found, install pykickstart
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.
- 解決檢查出來的問題
問題1:
]# cobbler setting report --name=server
解決:
]# cobbler setting edit --name=server --value=192.168.80.20
問題2:
]# cobbler setting report --name=next_server
解決:
]# cobbler setting edit --name=next_server --value=192.168.80.20
問題3:
解決:
]# vim /etc/xinetd.d/tftp
disable = yes --> no
問題4: 下載網(wǎng)絡(luò)引導(dǎo)文件,下載后的引導(dǎo)文件會存放在 /var/lib/cobbler/loaders 目錄下
解決:
]# cobbler get-loaders
task started: 2015-08-19_153812_get_loaders
task started (id=Download Bootloader Content, time=Wed Aug 19 15:38:12 2015)
downloading http://cobbler.github.com/loaders/README to /var/lib/cobbler/loaders/README
downloading http://cobbler.github.com/loaders/COPYING.elilo to /var/lib/cobbler/loaders/COPYING.elilo
downloading http://cobbler.github.com/loaders/COPYING.yaboot to /var/lib/cobbler/loaders/COPYING.yaboot
downloading http://cobbler.github.com/loaders/COPYING.syslinux to /var/lib/cobbler/loaders/COPYING.syslinux
downloading http://cobbler.github.com/loaders/elilo-3.8-ia64.efi to /var/lib/cobbler/loaders/elilo-ia64.efi
downloading http://cobbler.github.com/loaders/yaboot-1.3.17 to /var/lib/cobbler/loaders/yaboot
downloading http://cobbler.github.com/loaders/pxelinux.0-3.86 to /var/lib/cobbler/loaders/pxelinux.0
downloading http://cobbler.github.com/loaders/menu.c32-3.86 to /var/lib/cobbler/loaders/menu.c32
downloading http://cobbler.github.com/loaders/grub-0.97-x86.efi to /var/lib/cobbler/loaders/grub-x86.efi
downloading http://cobbler.github.com/loaders/grub-0.97-x86_64.efi to /var/lib/cobbler/loaders/grub-x86_64.efi
*** TASK COMPLETE ***
問題5:
解決:
]# vim /etc/xinetd.d/rsync
disable = yes --> no
問題6: 安裝 debmirror(如果沒有 Debian 主機(jī),該項為可選項)
解決:
]# yum install debmirror
# 并且在 /etc/debmirror.conf 中注釋這兩個項目:'dists'、'arches'
]# vim /etc/debmirror.conf
#@dists="sid";
#@arches="i386";
問題7: 安裝 pykickstart
解決:
]# yum install pykickstart
問題8: 生成新的root密碼,并在 /etc/cobbler/settings 文件中對 default_password_crypted 的值進(jìn)行替換
解決:
# syntax:
openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'
]# openssl passwd -1 -salt 'yue' 'Emc20160'
$1$yue$wzTcBFUcp8u6BayioJRUy0
]# cobbler setting edit --name=default_password_crypted --value='$1$yue$wzTcBFUcp8u6BayioJRUy0'
問題9: 安裝 cman 或 fence-agents,我這邊選擇安裝 cman
解決:
]# yum install cman
- 設(shè)置 cobbler 管理 dhcp
當(dāng)通過 cobbler 來管理 DHCP 時,使用的 DHCP 配置文件為 /etc/cobbler/dhcp.template
]# cobbler setting edit --name=manage_dhcp --value=1
- 配置 /etc/cobbler/dhcp.template
]# vim /etc/cobbler/dhcp.template
# 根據(jù)規(guī)劃,修改如下:
......
subnet 192.168.80.0 netmask 255.255.255.0 {
option routers 192.168.80.2;
option domain-name-servers 192.168.80.2;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.80.21 192.168.80.30;
......
- 設(shè)置 pxe_just_once
選項 pxe_just_once 預(yù)防將機(jī)器中的安裝循環(huán)配置為始終從網(wǎng)絡(luò)引導(dǎo)。激活此選項時,機(jī)器告訴 Cobbler 安裝已完成。Cobbler 將系統(tǒng)對象的 netboot 標(biāo)志更改為 false,這會強(qiáng)制機(jī)器從本地磁盤引導(dǎo)。
]# cobbler setting edit --name=pxe_just_once --value=1
- 重啟cobbler、xinetd
]# /etc/init.d/cobblerd restart
]# /etc/init.d/xinetd restart
- 再次檢查 cobbler
]# cobbler sync
]# cobbler check
No configuration problems found. All systems go.
至此,已完成 cobbler 的安裝、配置