一、系统环境准备
1、系统环境:CentOS7.5 x86-64
2、软件包:采用 yum 安装方式,为提高软件包下载速度,将源修改为阿里云。
二、安装Cobbler
2.1 安装cobbler相关软件包
shell> wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo shell> wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo shell> yum -y install cobbler cobbler-web pykickstart httpd rsync tftp-server dhcp xinetd shell> yum install fence-agents -y
2.2 安装debmirror(提供对Debian的支持,其他系统可略过)
shell> yum -y install debmirror
三、配置Cobbler
3.1 设置tftp和rsync服务
shell> sed -i '/disable/c\\tdisable\t\t\t= no' /etc/xinetd.d/tftp shell> cat > /etc/rsyncd.conf << EOF read only = yes list = no max connections = 100 hosts allow=10.52.0.0/16,10.32.0.0/16,192.168.0.0/16 uid = nobody gid = nobody log file = /var/log/rsyncd.log pid file = /var/run/rsyncd.pid lock file = /var/run/rsync.lock EOF
3.2 设置 root 默认密码(只对RedHat/CentOS系统有效)
# openssl passwd -1 -salt 'random-phrase-here' 'your-password-here' shell> openssl passwd -1 -salt '91donkey.com' '1q2w3e4r' $1$91donkey$KJwQNrYEdGksTB2L9v2bC0
3.3 修改 /etc/cobbler/settings 文件内容
# tftp服务器IP地址 next_server: 10.20.57.32 # cobbler管理DHCP manage_dhcp: 1 # cobbler管理rsync(可选) manage_rsnyc: 1 # cobbler管理dns(可选) manage_dns: 1 # 修改pxe_just_once值: # 1、预防由于服务器设置从网络引导,导致循环安装; # 2、激活此设置,机器会告诉Cobbler安装已完成。Cobbler会将对象的netboot标志改为false,这会强制服务器从本地引导。 pxe_just_once: 1 server: 10.20.57.32 default_password_crypted: "$1$91donkey$KJwQNrYEdGksTB2L9v2bC0"
3.4 配置 /etc/cobbler/dhcp.template 文件内容(节选)
subnet 10.20.48.0 netmask 255.255.248.0 { option routers 10.20.48.1; option domain-name-servers 114.114.114.114; option subnet-mask 255.255.248.0; range dynamic-bootp 10.20.49.1 10.20.49.20; default-lease-time 900; max-lease-time 1800; next-server $next_server; }
3.5 启动相关服务
# rsync shell> systemctl enable rsyncd && systemctl start rsyncd # xinetd shell> systemctl enable xinetd && systemctl start xinetd # httpd shell> systemctl enable httpd && systemctl start httpd # cobbler shell> systemctl enable cobblerd && systemctl start cobblerd shell> cobbler sync # dhcp shell> systemctl enable dhcpd && systemctl start dhcpd
3.6 开启动态更新
# 如果启用,Cobbler将允许动态修改设置,而无需重新启动到cobblerd守护程序。 shell> sed -i 's/allow_dynamic_settings: 0/allow_dynamic_settings: 1/' /etc/cobbler/settings shell> systemctl restart cobblerd
3.7 配置引导菜单
shell> cobbler get-loaders shell> cobbler signature update shell> cobbler sync
3.8 检查 cobbler 配置结果
shell> cobbler check The following are potential configuration items that you may want to fix: 1 : enable and start rsyncd.service with systemctl 2 : debmirror package is not installed, it will be required to manage debian deployments and repositories Restart cobblerd and then run 'cobbler sync' to apply changes.
3.9 修改 cobbler 数据目录
# 由于cobbler默认将数据放在/var目录下,而按照我的系统安装习惯,/var目录一般不会分太大空间,需要修改文件存放路径。 shell> mv /var/www/cobbler /export/ shell> ln -s /export/cobbler /var/www/cobbler
3.10 修改开机画面显示
shell> sed -i 's/cobbler.github.io/www.91donkey.com/' /etc/cobbler/pxe/pxedefault.template shell> cobbler sync
作者:龍龍小宝
原文:https://www.cnblogs.com/91donkey/p/11635375.html