CentOS7 operation and maintenance-Cobbler easy and automatic deployment and installation
- Cobbler automated deployment
- 1. One-click installation of EPEL source
- Two, modify the Cobbler main configuration file
- Three, Cobbler self-inspection
- Fourth, modify the TFTP configuration
- Five, download the boot operation file
- Sixth, set the new machine administrator password
- Seven, add the generated key to the Cobbler configuration file
- Eight, modify the DHCP template file
- Nine, Cobbler synchronization DHCP template
- 10. Import ISO image file
- 11. Start the installation
- 12. Digression-install graphical interface
Cobbler automated deployment
Cobbler is an open source project developed using Python. It provides a fully automatic batch and rapid network installation environment for the establishment of a Linux system by concentrating all the services involved in the deployment system.
1. One-click installation of EPEL source
将代码保存为 xx.sh
chmod 777 xx.sh
./xx.sh运行代码
#!/bin/bash
cd /etc/yum.repos.d/;
rm -rf *;
wget -nc http://mirrors.aliyun.com/repo/Centos-7.repo;
mv Centos-7.repo CentOS-Base.repo;
yum clean all && yum makecache;
wget https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-13.noarch.rpm;
rpm -ivh epel-release-7-13.noarch.rpm;
yum clean all && yum makecache;
yum install -y cobbler dhcp tftp-server pykickstart httpd rsync xinetid;
systemctl stop firewalld;
setenforce 0;
Manually install and
download the EPEL package [site resources] After
inputting rz
in the Shell, select the file and install it
rpm -ivh epel-release-7-13.noarch.rpm
Two, modify the Cobbler main configuration file
vim /etc/cobbler/settings
next_server: 192.168.1.1
#指向tftp服务器的IP,即本机IP
server: 192.168.1.1
#指向cobbler服务器的IP,即本机IP
manage_dhcp: 1
#让cobbler管理dhcp服务
manage_rsync: 1
#让cobbler管理rsync服务
manage_tftp: 1
#让cobbler管理tftp服务
systemctl start httpd
systemctl start cobblerd
#开启服务
Three, Cobbler self-inspection
cobbler check
Fourth, modify the TFTP configuration
vim /etc/xinetd.d/tftp
Open service
systemctl restart xinetd
systemctl start rsyncd
Five, download the boot operation file
cobbler get-loaders
Sixth, set the new machine administrator password
Because Cobbler uses the "salt" method to set the password, this form is also used here to generate a password
openssl passwd -1 -salt '123456' '123456'
Seven, add the generated key to the Cobbler configuration file
vim /etc/cobbler/settings
// 使用命令模式
/default_passwd 定位位置
Change default_password_crypted
the value in to the value generated in the previous step
Eight, modify the DHCP template file
vim /etc/cobbler/dhcp.template
subnet 192.168.1.0 netmask 255.255.255.0 {
option routers 192.168.1.1;
#修改网关
option domain-name-servers 192.168.1.2;
#修改DNS,如果网卡使用的是dhcp模式
#可通过nslookup 127.0.0.1 | grep server 查询 DNS地址
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.1.100 192.168.1.200;
#修改地址池
Nine, Cobbler synchronization DHCP template
This step may take a long time, wait patiently
cobbler sync
systemctl restart dhcpd
// 重启一下DHCP服务
10. Import ISO image file
The everything version is recommended here
mount /dev/sr0 /mnt
// 挂载镜像文件
Import the Linux kernel in the iso image and initialize the image file
cobbler import --path=/mnt/ --name=CentOS-7-x86_64 --arch=x86_64
#参数说明
#--path 表示镜像所挂载的目录
#--name 表示为安装源定义的名字
#--atch 表示指定安装源的系统位数
#默认导入存放路径为/var/www/cobbler/ks_mirror/CentOS-7-x86_64
systemctl restart cobblerd.service
systemctl restart dhcpd.service
systemctl restart xinetd.service
systemctl restart httpd.service
// 重启所有服务
11. Start the installation
Recommended bare metal memory ≥ 2GB
12. Digression-install graphical interface
yum groupinstall "GNOME Desktop" "Graphical Administration Tools"
After setting the installation startx
orreboot