CentOS7下部署Cobbler实现PXE+KS自动化安装


CentOS7下部署Cobbler实现PXE+KS自动化安装

文章插图
 
之前有介绍《centos7下部署Cobbler实现PXE+Kickstart自动化安装》
本周对上面步骤进行了脚本化
具体脚本如下
cobbler_onekey_install.sh--------------一键安装cobbler脚本
#!/bin/bashsed -i '$aIPADDR1=192.168.31.200' /etc/sysconfig/network-scripts/ifcfg-en*sed -i '$aPREFIX1=24'  /etc/sysconfig/network-scripts/ifcfg-en*service network restartcd /opttar -zxvf cobbler_rpmpackage.tar.gz -C /optmkdir -p /opt/yum_repobackupmv /etc/yum.repos.d/*.repo /opt/yum_repobackup/cp  -rf /opt/cobblerlocal.repo /etc/yum.repos.d/yum clean allyum makecacheyum install -y httpd dhcp cobbler tftp-server pykickstartsystemctl start httpdsystemctl enable httpdsystemctl enable cobblerdsystemctl restart cobblerdsleep 5cobbler checkcobbler syncsleep 5sed -i "s/server: 127.0.0.1/server: 192.168.31.200/g" /etc/cobbler/settingssed -i "s/^next_server: 127.0.0.1/ next_server: 192.168.31.200/g" /etc/cobbler/settingssed -i 's/^.*disable.*$/        disable                 = no/g' /etc/xinetd.d/tftpsystemctl restart tftp.service#cobbler get-loaderstar -zxvf /opt/cobbler_loaders.tar.gz -C /var/lib/cobbler/systemctl start rsyncdsystemctl enable rsyncdsleep 2#password admin@2020sed -i 's/^default_password_crypted.*$/default_password_crypted: "$1$root$afc2RZysD6SOx07LLBnwB0"/g' /etc/cobbler/settingssed -i "s/manage_dhcp: 0/manage_dhcp: 1/g" /etc/cobbler/settingssed -i "s/192.168.1./192.168.31./g" /etc/cobbler/dhcp.templatesystemctl restart cobblerdsleep 5cobbler syncsleep 5cobbler check 
CentOS7下部署Cobbler实现PXE+KS自动化安装

文章插图
 

CentOS7下部署Cobbler实现PXE+KS自动化安装

文章插图
 

CentOS7下部署Cobbler实现PXE+KS自动化安装

文章插图
 
具体操作步骤如下
CentOS7下部署Cobbler实现PXE+KS自动化安装

文章插图
 
将上图中四个文件传到CentOS7服务器上/opt目录
注意 , 必须是/opt目录
 
1).cobbler_loaders.tar.gz --------------cobbler所需的loaders文件
2).cobbler_rpmpackage.tar.gz--------------cobbler服务器所需的rpm包以及对应的本地仓库repository
3).cobblerlocal.repo --------------cobbler本地yum源repo文件
4).cobbler_onekey_install.sh--------------一键安装cobbler脚本
 
2、chmod 755 cobbler_onekey_install.sh
./cobbler_onekey_install.sh 安装cobbler
 
【CentOS7下部署Cobbler实现PXE+KS自动化安装】该脚本会给网卡添加一个192.168.31.200/24的IP地址
执行该脚本即可立即搭建起cobbler服务器




    推荐阅读