Cobbler 安装与部署
操作系统及内核
[root@localhost ~]# uname -a
Linux localhost.dev 3.10.0-327.10.1.el7.x86_64 #1 SMP Tue Feb 16 17:03:50 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ~]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
安装前的依赖;
# yum -y install createrepo httpd mkisofs mod_wsgi mod_ssl python-cheetah python-netaddr python-simplejson python-urlgrabber PyYAML rsync syslinux tftp-server yum-utils dhcp
安装如下第三方包;
# yum -y install Django python-devel python-setuptools openssl git make python-cheetah
yum 安装cobbler;
# yum -y install cobbler
启动cobbler和httpd;
# service cobblerd start
# chkconfig cobblerd on
# service httpd start
# service cobblerd on
检查cobbler的安装配置 cobbler check;
# 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 : change 'disable' to 'no' in /etc/xinetd.d/tftp
5 : 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 messag 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.
6 : enable and start rsyncd.service with systemctl
7 : debmirror package is not installed, it will be required to manage debian deployments and repositories
8 : ksvalidator was not found, install pykickstart
9 : 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
10 : 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 : 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.
# 修改为本机的IP地址
vim /etc/cobbler/settings
server 192.168.1.94
- 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.
# 修改为本机的IP地址
vim /etc/cobbler/settings
next_server 192.168.1.94
vim /etc/selinux/config
SELINUX=disabled
- 4 : change 'disable' to 'no' in /etc/xinetd.d/tftp
# 修改 /etc/xinetd.d/tftp 将disable项由yes改为no
vim /etc/xinetd.d/tftp
# default: off
# description: The tftp server serves files using the trivial file transfer \
# protocol. The tftp protocol is often used to boot diskless \
# workstations, download configuration files to network-aware printers, \
# and to start the installation process for some operating systems.
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /var/lib/tftpboot
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}
- 5 : 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.
# 下载引导操作系统文件
# cobbler get-loaders
- 6 : enable and start rsyncd.service with systemctl
# systemctl enable rsyncd
- 7 : debmirror package is not installed, it will be required to manage debian deployments and repositories
# yum -y install debmirror
vim /etc/debmirror.conf
# 修改 /etc/debmirror.conf 配置文件,注释掉 @dists 和 @arches 两行
sed -i 's|@dists=.*|#@dists=|' /etc/debmirror.conf
sed -i 's|@arches=.*|#@arches=|' /etc/debmirror.conf
- 8 : ksvalidator was not found, install pykickstart
# yum -y install pykickstart
- 9 : 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
# 这里生成密钥和配置默认密钥,ks文件引用
openssl passwd -1 -salt 'random-phrase-here' 'ylmfylmf'
$1$random-p$dkAvjM82Vzxsmn//iQG6f0
加入cobbler配置
vim /etc/cobbler/settings
grep default_password_crypted /etc/cobbler/settings#修改为如下配置
default_password_crypted: "$1$random-p$dkAvjM82Vzxsmn//iQG6f0"
- 10 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them
# yum –y install cman fence-agents
修改cobbler的主配置文件,启用dhcp和rsync
vim /etc/cobbler/settings #Cobbler主配置文件
sed -i 's/manage_dhcp: 0/manage_dhcp: 1/g' /etc/cobbler/settings
sed -i 's/manage_rsync: 0/manage_rsync: 1/g' /etc/cobbler/settings
同步配置文件
# cobbler sync
最后,重启cobbler
# systemctl restart cobblerd
至此,cobbler 环境搭建完毕。
参考文章:
Cobbler自动化部署 2016.08.05
Cobbler部署指南之安装篇 2013.03.29