1、安装 cobbler
1.1、安装前的准备
- 安装epel源,在centos下,直接执行
]# yum install epel-release
- 安装 cobbler 所需的配合软件:DHCP、TFTP、Apache
注:
cobbler 支持管理两种DHCP,ISC DHCP 和 dnsmasq ,通过以下命令,默认安装的是 ISC DHCP
]# yum install dhcp tftp-server httpd
- 安装cobbler
]# yum install cobbler
注1:
实验机的配置请参考《VMware --- CentOS6.x 实验机的安装配置》
注2:
实验机所使用的操作系统版本为:CentOS release 6.6 (Final)
注3:
实验机本机 IP 为:192.168.80.20
2、配置 cobbler
2.1 执行 cobbler check
- 启动 cobbler 和 http
]# /etc/init.d/cobblerd start
]# /etc/init.d/httpd start
]# chkconfig cobblerd on
]# chkconfig httpd on
- 开启 cobbler 的动态配置
]# 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: 下载网络引导文件,下载后的引导文件会存放在 /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 主机,该项为可选项)
解决:
]# 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 的值进行替换
解决:
# 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
- 设置 cobbler 管理 dhcp
当通过 cobbler 来管理 DHCP 时,使用的 DHCP 配置文件为 /etc/cobbler/dhcp.template
]# cobbler setting edit --name=manage_dhcp --value=1
- 配置 /etc/cobbler/dhcp.template
]# vim /etc/cobbler/dhcp.template
# 根据规划,修改如下:
......
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;
......
- 设置 pxe_just_once
选项 pxe_just_once 预防将机器中的安装循环配置为始终从网络引导。激活此选项时,机器告诉 Cobbler 安装已完成。Cobbler 将系统对象的 netboot 标志更改为 false,这会强制机器从本地磁盘引导。
]# 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 的安装、配置