Cobbler是一款自动化操作系统部署的实现工具,由Python语言开发,是对PXE的二次封装。融合多种特性,提供了CLI和Web的管理形式。同时,Cobbler也提供了API接口,方便二次开发使用。它不仅可以安装物理机,同时也支持kvm、xen虚拟化、Guest OS的安装。另外,它还能结合Puppet等集中化管理软件,实现自动化管理。
[root@localhost ~]#rpm -ivh epel-release-latest-7.noarch.rpm #Cobbler相关软件包是由epel源提供
[root@localhost ~]# yum list #自动加载yum更新源
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ls
[root@localhost ~]# yum -y install cobbler cobbler-web dhcp tftp-server pykickstart httpd rsync xinetd
cobbler:cobbler主包
cobbler-web:cobbler支持web服务包(图形化界面)
tftp-server:tftp简单文件传输包
pykickstart:无人值守安装模板,即应答文件
httpd: 通过wbe服务检测管理cobbler
rsync: 远程同步管理、同步dhcp
xinetd:管理rsync、tftp-server服务
[root@localhost ~]# systemctl start cobblerd.service
[root@localhost ~]# systemctl start httpd.service
[root@localhost ~]# setenforce 0 #临时关闭selinux
[root@localhost ~]# cobbler check
[root@localhost ~]# vim /etc/sysconfig/selinux
[root@localhost ~]# systemctl stop firewalld.service
[root@localhost ~]# systemctl disable firewalld.service #开机关闭防火墙
[root@localhost ~]# reboot #重新启动
[root@localhost ~]# cd /etc/cobbler/
[root@localhost cobbler]# vim settings
server: 192.168.40.120 #指向cobbler服务器
next_server: 192.168.40.120 #指向tftp服务器(PXE位置)
manage_dhcp: 1 # "1"代表开启dhcp管理功能
[root@localhost ~]# vim /etc/xinetd.d/tftp #tftp是交由xinetd管理,xinetd目录下有对应的和安装的软件包相同的文件
[root@localhost ~]# openssl passwd -1 -salt '123' '123' #使用盐值加密
$1$123$nE5gIYTYiF1PIXVOFjQaW/ #对应的'123'的加密密文
[root@localhost ~]# vim /etc/cobbler/settings
[root@localhost ~]# cobbler get-loaders
[root@localhost ~]# systemctl restart xinetd.service
[root@localhost ~]# systemctl start rsyncd.service
[root@localhost ~]# systemctl enable rsyncd.service #设置开机自启动
[root@localhost ~]# cd /etc/cobbler/
[root@localhost cobbler]# vim dhcp.template #编辑dhcp模板文件
[root@localhost ~]# cobbler sync #同步生成DHCP配置文件
[root@localhost ~]# cd /etc/dhcp/
[root@localhost dhcp]# vim dhcpd.conf #查看DHCP配置文件
[root@localhost ~]# mount /dev/sr0 /mnt/sr0/
[root@localhost ~]# cobbler import --path=/mnt/sr0 --name=CentOS-7-x86_64 --arch=x86_64 #导入需要点时间
cobbler import:通过Cobbler的import命令从IOS安装镜像中导入安装所需要的程序包
path:镜像(光盘)挂载的目录
name:安装源的定义的名字
arch:表示指定的安装源是32位还是64位、ia64
[root@localhost ~]# cd /var/www/cobbler/ks_mirror/
[root@localhost ks_mirror]# ls
[root@localhost ~]# yum -y install tree
[root@localhost ~]# tree /var/lib/tftpboot/images
[root@localhost ~]# systemctl restart cobblerd.service
[root@localhost ~]# systemctl restart dhcpd.service
[root@localhost ~]# systemctl restart xinetd.service
[root@localhost ~]# systemctl restart httpd.service
[root@localhost ~]# htdigest -c /etc/cobbler/users.digest Cobbler admin #创建的用户写入users.digest文件中
htdigest:Apache的Web服务器内置工具,用于创建和更新储存用户名、域和用于摘要认证的密码文件
-c:创建密码文件
Cobbler admin:创建Cobbler对象的用户名为admin
[root@localhost ~]# vim /etc/cobbler/modules.conf
[root@localhost ~]# vim /etc/cobbler/modules.conf
[root@localhost ~]# useradd testWeb #添加测试用户
[root@localhost ~]# passwd testWeb
[root@localhost ~]# vim /etc/cobbler/users.conf
[root@localhost ~]# systemctl restart httpd.service
[root@localhost ~]# systemctl restart cobblerd.service
原文链接:http://blog.51cto.com/11905606/2151857?source=dra