Cobbler automatic deployment installation
- Experiment preparation
- experiment procedure
-
- 1. Build an online yum source
- Two, automatically load the online update source
- Three, install Cobbler and its related service packages
- Fourth, modify the main configuration file of cobbler
- Five, start related services and close the firewall and selinux
- Six, open tftp service and rsync service
- Seven, download the boot operating system file
- Eight, set the initial password of the Cobbler user
- Nine, configure dhcp service
- 10. Import ISO image file
- 11. Restart all services
- 12. Use cobbler check to check the settings of Cobbler
- 13. After all configurations are completed, open the blank host to automatically install the system
- 14. If you need a graphical interface, you can install it manually
Cobbler is an open source project developed using Python. It provides a fully automated and batch network installation environment for quickly establishing a Linux system by integrating all the services involved in the deployment system.
Experiment preparation
- A Linux server (Centos7 system, what configuration is best not)
- A blank virtual machine (no mirror selected)
- Need to connect to the Internet, and all virtual machines use NAT mode
experiment procedure
1. Build an online yum source
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
Two, automatically load the online update source
yum list
Three, install Cobbler and its related service packages
yum install -y cobbler dhcp tftp-server pykickstart httpd rsync xinetd
The functions of each software are as follows:
cobbler | Used to quickly establish a Linux network installation environment |
---|---|
dhcp | Used to automatically assign IP addresses to blank hosts |
tftp-server | Provide boot image file download |
pykickstart | Implement unattended installation |
httpd | Run as a console program |
rsync | Realize data synchronization |
xinetd | Provide access control, enhanced log and resource management functions |
安装完之后最好查一下是不是都安装上了
rpm -q cobbler dhcp tftp-server pykickstart httpd rsync xinetd
Fourth, modify the main configuration file of cobbler
vim /etc/cobbler/settings
next_server: 192.168.153.10 #指向tftp服务器的IP,即本机IP
server: 192.168.153.10 #指向cobbler服务器的IP,即本机IP
manage_dhcp: 1 #让cobbler管理dhcp服务
manage_rsync: 1 #让cobbler管理rsync服务
manage_tftpd: 1 #让cobbler管理tftp服务
Five, start related services and close the firewall and selinux
systemctl start httpd.service #开启http服务
systemctl start cobblerd.service #开启cobbler服务
systemctl stop firewalld.service #关闭防火墙
setenforce 0
Six, open tftp service and rsync service
6.1 Modify the configuration file of tftp
vim /etc/xinetd.d/tftp
6.2 Start service
systemctl restart xinetd.service
systemctl start rsyncd.service
Seven, download the boot operating system file
cobbler get-loaders
Eight, set the initial password of the Cobbler user
8.1 Use salt encryption to generate keys
openssl passwd -1 -salt '123456' '123456' #' '里为安装的虚拟机系统的root密码
8.2 Add the generated key to the Cobbler configuration file
vim /etc/cobbler/settings
Nine, configure dhcp service
9.1 Modify the template file of Cobbler management dhcp service
vim /etc/cobbler/dhcp.template
9.2 Synchronize the configured template file to the configuration file of the DHCP service
cobbler sync
9.3 Restart the DHCP service
systemctl restart dhcpd.service
10. Import ISO image file
10.1 Mount image file
mount /dev/sr0 /mnt
10.2 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
10.3 Check whether the kernel and initialization files are in the tftp-server shared directory
yum install -y tree #系统默认没有安装,需手动安装tree
tree /var/lib/tftpboot/images #查看文件是否存在
11. Restart all services
systemctl restart cobblerd.service
systemctl restart dhcpd.service
systemctl restart xinetd.service
systemctl restart httpd.service
12. Use cobbler check to check the settings of Cobbler
Note that the configuration is completed when the check result is consistent with the above figure, but there is another situation:
If the content of the yellow box in the figure appears, there is actually no problem with the configuration, but you can change it if you are not worried:
systemctl start rsyncd.service
systemctl enable rsyncd.service
13. After all configurations are completed, open the blank host to automatically install the system
Note: This installation method is a minimal installation, and the installed system only has a character interface
14. If you need a graphical interface, you can install it manually
yum list
yum -y groupinstall "server with GUI"