cobbler自动化部署
cobbler集成的服务#
PXE服务支持
DHCP服务管理
DNS服务管理
电源管理
Kickstart服务支持
YUM仓库管理
TFTP
Apache
cobbler工作原理#
Server端
启动Cobbler服务
进行Cobbler错误检查,执行cobbler check命令
进行配置同步,执行cobbler sync命令
复制相关启动文件到TFTP目录中
启动DHCP服务,提供地址分配
DHCP服务分配IP地址
TFTP传输启动文件
Server端接收安装信息
Server端发送ISO镜像与Kickstart文件
Client端
客户端以PXE模式启动
客户端获取IP地址
通过TFTP服务器获取启动文件
进入Cobbler安装选择界面
根据配置信息准备安装系统
加载Kickstart文件
传输系统安装的其它文件
进行安装系统
cobbler安装
说明:虚拟机网卡采用NAT模式或者仅主机模式,不要使用桥接模式,因为后面会搭建DHCP服务器,在同一个局域网多个DHCP服务会有冲突。
VMware的NAT模式的dhcp服务也关闭,避免干扰。
关闭防火墙、selinux等 [root@cobbler ~]# systemctl stop firewalld [root@cobbler ~]# systemctl disable firewalld [root@cobbler ~]# setenforce 0 [root@cobbler ~]# sed -i 's/^SELINUX=.*/SELINUX=disabled/' /etc/sysconfig/selinux
安装cobbler
配置epel源 [root@cobbler ~]# yum -y install epel-release # 安装cobbler及dhcp httpd xinetd cobbler-web [root@cobbler ~]# yum -y install cobbler cobbler-web tftp-server dhcp httpd xinetd # 启动cobbler及httpd并加入开机启动 [root@cobbler ~]# systemctl start httpd cobblerd [root@cobbler ~]# systemctl enable httpd cobblerd
查看安装后相关文件
[root@cobbler ~]# rpm -ql cobbler /etc/cobbler # 配置文件目录 /etc/cobbler/settings # cobbler主配置文件,这个文件是YAML格式,Cobbler是python写的程序。 /etc/cobbler/dhcp.template # DHCP服务的配置模板 /etc/cobbler/tftpd.template # tftp服务的配置模板 /etc/cobbler/rsync.template # rsync服务的配置模板 /etc/cobbler/iso # iso模板配置文件目录 /etc/cobbler/pxe # pxe模板文件目录 /etc/cobbler/power # 电源的配置文件目录 /etc/cobbler/users.conf # Web服务授权配置文件 /etc/cobbler/users.digest # 用于web访问的用户名密码配置文件 /etc/cobbler/dnsmasq.template # DNS服务的配置模板 /etc/cobbler/modules.conf # Cobbler模块配置文件 /var/lib/cobbler # Cobbler数据目录 /var/lib/cobbler/config # 配置文件 /var/lib/cobbler/kickstarts # 默认存放kickstart文件 /var/lib/cobbler/loaders # 存放的各种引导程序 /var/www/cobbler # 系统安装镜像目录 /var/www/cobbler/ks_mirror # 导入的系统镜像列表 /var/www/cobbler/images # 导入的系统镜像启动文件 /var/www/cobbler/repo_mirror # yum源存储目录 /var/log/cobbler # 日志目录 /var/log/cobbler/install.log # 客户端系统安装日志 /var/log/cobbler/cobbler.log # cobbler日志
配置cobbler
[root@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 : enable and start rsyncd.service with systemctl 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.
下面解决第一个问题
[root@cobbler ~] # yum -y install syslinux [root@cobbler ~] # cp /usr/share/syslinux/pxelinux.0 /var/lib/cobbler/loaders/ [root@cobbler ~] # cp /usr/share/syslinux/menu.c32 /var/lib/cobbler/loaders/ [root@cobbler ~] # systemctl restart cobbled [root@cobbler ~] # cobbler get-loaders #再次执行则成功
下面解决其他问题
vim /etc/cobbler/settings 1修改 server地址为192.168.1.63 自己服务器ip 改:390 server: 127.0.0.1 为:390 server: 192.168.1.63 2修改 next_server地址为 192.168.1.63 自己服务器ip 改:278 next_serve: 127.0.0.1 为:278 next_serve: 192.168.1.63 3修改 tftp 服务被 xinetd 服务管理 vim /etc/xinetd.d/tftp 改:14 disable = yes 为:14 disable = no 修改xinetd 和 tftpd 服务开机启动 systemctl start xinetd tftp && systemctl enable xinetd tftp 4下载操作系统引导文件 cobbler get-loaders 5修改 rsyncd 服务为开机自启动状态并启用它 systemctl start rsyncd && systemctl enable rsyncd 6修改操作系统默认密码 openssl passwd -1 -salt 'root' '123456' 得出加密的密码,复制$1$root$j0bp.KLPyr.u9kgQ428D10 vim /etc/cobbler/settings 101 default_password_crypted: "$1$mF86/UHC$WvcIcX2t6crBz2onWxyac." #删除此双引号中加密密码,并粘贴
直到
[root@localhost ~]# cobbler check
No configuration problems found. All systems go.
这样,就可以进行下一步
配置DHCP
cobbler setting edit --name=manage_dhcp --value=1
# 修改cobbler的dhcp模块,不要直接修改dhcp本身的配置文件,因为cobbler会覆盖
vim /etc/cobbler/dhcp.template
浙公网安备 33010602011771号