文章插图
之前有介绍《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服务器上/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服务器
推荐阅读
- 电脑发送的信息是如何到达目的地的?简单了解下网络传输原理过程
- 为什么没人写方腊起义 方腊宋江起义
- 雀斑怎么去除 8款食疗方让你提前“下斑”
- 清朝灭亡后的皇亲贵族去哪了 清朝灭亡后满清贵族下场
- 清朝八大铁帽子王都有谁?大多下场悲惨 清朝最后一个铁帽子王
- 描写楚汉战争在亥下最后决战的一首名曲是 项羽亥下悲歌
- 什么叫巫蛊之术 真的有巫蛊之术吗
- 療中蠱毒吐血或下血皆如爛肝又方的功效与作用
- 不为5斗米折腰下一句 不为五斗米不折腰的故事概括
- 疗中蛊毒吐血或下血皆如烂肝又方的功效与作用