cobbler是一个可以实现批量安装系统的Linux应用程序。它有别于pxe+kickstart,cobbler可以实现同个服务器批量安装不同操作系统版本。
环境准备:
#ifconfig
#systemctl status firewalld
#getenforce
搭建本地源和扩展源
#vim /etc/yum.repos.d/local.repo [local] name=local enabled=1 gpgcheck=0 baseurl=file:///mnt [epel] name=epel enabled=1 gpgcheck=0 baseurl=https://mirrors.aliyun.com/epel/7/x86_64/ [centos] name=centos base enabled=1 gpgcheck=0 baseurl=http://mirrors.163.com/centos/7/os/x86_64/ #mount /dev/cdrom /mnt #yum clean all
配置
#yum install cobbler dhcp tftp-server xinetd syslinux httpd -y vim /etc/dhcp/dhcpd.conf subnet 192.168.152.0 netmask 255.255.255.0 { range 192.168.152.10 192.168.152.20; default-lease-time 600; max-lease-time 7200; filename "pxelinux.0"; } #systemctl restart dhcpd #systemctl enable dhcpd #vim /etc/xinetd.d/tftp disable yes->no
#systemctl restart xinetd #systemctl enable xinetd #systemctl restart cobblerd #cobbler check
解决报错:
#systemctl restart httpd #vim /etc/cobbler/settings 把next_server和server修改成仅主机ip
#systemctl restart rsyncd #systemctl enable rsyncd #yum -y install pykickstart #openssl passwd -1 -salt "123" "123" 加密数据第一个123是随机数,第二个123是密码
#vim /etc/cobbler/settings
#systemctl restart cobblerd #cobbler sync
#cobbler check 成功
#ls /mnt 查看光盘挂载
#cobbler import --path=/mnt --name="centos7.5" #cobbler distro list
#cd #cp anaconda-ks.cfg /var/lib/cobbler/kickstarts/ks.cfg #vim /var/lib/cobbler/kickstarts/ks.cfg 修改cdrom
#cobbler profile add --distro=centos7.5-x86_64 --kickstart=/var/lib/cobbler/kickstarts/ks.cfg --name="centos7.5_pikachu" cobbler profile add --distro=centos7.5-x86_64 --kickstart=/var/lib/cobbler/kickstarts/ks.cfg --name="centos7.5_pikachu" #cobbler profile list
#cobbler profile remove --name="centos7.5-x86_64" #cobbler profile list
新创建一台虚拟机