(7)Cobble的自动化部署系统

前言:

cobble的自动部署可以在,软件和硬件上使用dhcp广播的方式,自动部署系统,不用一台一台手动的安装操作系统,还可以使用web页面,定制专属的操作系统。

使用Rocky源
 

本机的ip地址是192.168.121.30,使用网卡NAT模式。更改主机名,关掉防火墙和selinux,做好时间同步。

# setenforce 0

# systemctl stop firewalld.service 
# systemctl disable firewalld.service

# yum -y install httpd dhcp* tftp tftp-server pykickstart rsync rsync-daemon    -----安装软件包,加粗的最后安装

# yum -y install cobbler-web --allowerasing

# systemctl restart httpd
[root@server ~]# systemctl enable httpd   ---重启,下次自启动httpd服务

rsyncd, tftp,cobblerd这三个也设置下次启动生效,并重启

# vim /etc/cobbler/settings.yaml     -----更改四个地方

 ---更改主机IP地址和密码,登录用户的,一开始随机

/server:192.168.121.30 更改服务主机IP地址

/next_server: 192.168.121.30

/default_pass   更改随机密码

/maage_chcp true  开启dhcp

# openssl passwd -1 -salt "ZZ" '123'  ---生成MD5加密的密码123,复制到default_pass里面

#systemctl restart cobb  重启服务

# cobbler check     ----解决五个问题

# yum -y install syslinux*

# cd /usr/share/syslinux/

[root@cobbler syslinux]# cp pxelinux.0 /var/lib/cobbler/loaders/
[root@cobbler syslinux]# cp menu.c32 /var/lib/cobbler/loaders/

# yum -y install yum-utils  解决问题

# vim /etc/cobbler/dhcp.template 配置地址池

subnet 192.168.121.0 netmask 255.255.255.0 {
     option routers             192.168.121.2;       #本机网卡的网关
     option domain-name-servers 8.8.8.8;
     option subnet-mask         255.255.255.0;
     range dynamic-bootp        192.168.121.100 192.168.121.200;
     default-lease-time         21600;
     max-lease-time             43200;

#systemctl restart httpd
 #systemctl restart cobblerd.service 
 #cobbler sync  同步
 #systemctl restart dhcpd

将镜像断开,换成图形化的镜像

#mount /dev/cd /mnt

# cobbler import --path=/mnt/ --name=Rocky-9 carch=x86_64  生成镜像

# cobbler distro report --name Rocky-9-x86_64  查看镜像

# cobbler profile get-autoinstall --name Rocky-9-x86_64 > /var/lib/cobbler/templates/rocky9.ks  生成版本文件信息

#vim /var/lib/cobbler/templates/rocky9.ks

# Firewall configuration
firewall --disabled
# Run the Setup Agent on first boot
firstboot --disable
# System keyboard
keyboard us
# System language
lang en_US
# Use network installation
url --url=http://192.168.121.30/cblr/links/Rocky-9-x86_64
# If any cobbler repo definitions were referenced in the kickstart profile, include them here.
repo-name=source-1 --baseurl="http://192.168.121.30/cobbler/distro_mirror/AppStream"
repo-name=source-2 --baseurl="http://192.168.121.30/cobbler/distro_mirror/BaseOS"

 

repo --name=source-1 --baseurl="http://192.168.121.30/cobbler/distro_mirror/AppStream"
repo --name=source-2 --baseurl="http://192.168.121.30/cobbler/distro_mirror/BaseOS"

@^minimal-environment@^minimal-environment

# cd /usr/share/cobbler/bin/ 

# bash mkgrub.sh   -----运行python脚本

[root@cobbler ~]# systemctl restart cobblerd.service 
[root@cobbler ~]# systemctl restart dhcpd
[root@cobbler ~]# systemctl restart httpd
[root@cobbler ~]# systemctl restart tftp
[root@cobbler ~]# systemctl enable tftp
[root@cobbler ~]# cobbler sync

重开一台虚拟机,连接到NAT网卡,出现自动部署

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值