Cobbler automatically deploys and installs
Article Directory
- Cobbler automatically deploys and installs
-
- Cobbler automatic installation service construction steps
-
- 1. Import epel source
- 2. Install Cobbler and its related service packages
- 3. Modify the main cobbler configuration file
- 4. Start related services and close the firewall and selinux
- 5. Use the cobbler check command to check the settings of Cobbler, and query items that need to be changed.
- 6. Turn on the tftp service and rsync service
- 7. Download the boot operating system file
- 8. Set the initial password of the Cobbler user
- 9. Configure dhcp service
- 10. Import the ISO image file
- 11. Restart all services
- 12. Then use cobbler check to check the settings of Cobbler
- 13. After all configurations are completed, turn on the blank host to automatically install the system
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 concentrating all the services involved in the deployment system.
Experiment preparation
- A Linux server (Centos7 system, IP: 192.168.80.134)
- A blank virtual machine
- Need to be connected to the Internet, and all virtual machines use NAT mode
Related software package link: https://pan.baidu.com/s/1Cl2H_cufGmbHCWfs_mObCQ Password: desg
Cobbler automatic installation service construction steps
1. Import epel source
After downloading the installation package below, there is no need to unzip
Pull it directly into Xshell. After the transmission is completed, as shown in the figure below, rz -E will also appear in Xshell, just click Close.
Then install the dependency package
rpm –ivh epel-release-latest-7.noarch.rpm #安装依赖包
yum list #自动加载在线更新源
2. Install Cobbler and its related service packages
yum install -y cobbler dhcp tftp-server pykickstart httpd rsync xinetd
2.1 The functions of each software are as follows
- Cobbler is used to quickly establish a Linux network installation environment
- dhcp is used to automatically assign IP addresses to blank hosts
- tftp-server provides downloading of boot image files
- pykickstart realizes unattended installation
- httpd runs as a console program
- rsync realizes data synchronization
- xinetd provides access control, enhanced log and resource management functions
3. Modify the main cobbler configuration file
vim /etc/cobbler/settings
#Modify the following items
-
next_server: 192.168.xx #Point to the IP of the tftp server, that is, the local IP
-
server: 192.168.xx #Point to the IP of the cobbler server, that is, the local IP
-
manage_dhcp: 1 #Let cobbler manage the dhcp service
-
manage_rsync: 1 #Let cobbler manage the rsync service
-
manage_tftp: 1 #Let cobbler manage tftp service
4. Start related services and close the firewall and selinux
systemctl start httpd.service #开启http服务
systemctl start cobblerd.service #开启cobbler服务
systemctl stop firewalld #关闭防火墙服务
setenforce 0 #关闭安全选项
5. Use the cobbler check command to check the settings of Cobbler, and query items that need to be changed.
cobbler check
6. Turn on the tftp service and rsync service
6.1 Modify tftp configuration file
vim /etc/xinetd.d/tftp #编辑tftp配置文件
disable=no #开启tftp服务
6.2 Start service
systemctl restart xinetd.service
systemctl start rsyncd.service
ps aux | grep "xinetd" 或者 ps -elf | grep "xinetd"
7. Download the boot operating system file
cobbler get-loaders #也可跟上--force表示强制执行
8. Set the initial password of the Cobbler user
8.1 Use salt encryption to generate keys
openssl passwd -1 -salt 'abc123' 'abc123'
The password can be written casually, abc123 is also the password of the root user after the system is installed, the key generated below is right-clicked and copied, and you will need to use it later
8.2 Add the generated key to the Cobbler configuration file
Enter the cobbler configuration file through the following code
vim /etc/cobbler/settings
9. Configure dhcp service
9.1 Modify the template file of Cobbler management dhcp service
vim /etc/cobbler/dhcp.template
subnet 192.168.x.0 netmask 255.255.255.0 {
option routers 192.168.x.x; #修改网关
option domain-name-servers 192.168.x.x; #修改DNS,如果网卡使用的是dhcp模式,可通过nslookup 127.0.0.1 | grep server 查询DNS地址
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.x.x 192.168.x.x; #修改地址池
You can also obtain the gateway and DNS server addresses through the following operations
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 the 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
#Parameter Description
#--Path indicates the directory where the mirror is mounted
#--Name indicates the name defined for the installation source
#–Atch indicates the number of system bits of the specified installation source
#The default import storage path is /var/www/cobbler/ks_mirror/CentOS-7-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. Then use cobbler check to check the settings of Cobbler
cobbler check
13. After all configurations are completed, turn on the blank host to automatically install the system
Steps to create a blank virtual machine
compatibility
Installation source
Operating system selection
Choose a location to install
Processor settings
The virtual machine memory must be at least 2G, otherwise the installer will prompt that the memory space is insufficient, and the error will be stuck
Select NAT mode for network type
I/O controller type default
Disk type default
Select disk default
Customize the capacity
Specify the disk default
No need to customize hardware, click Finish
A prompt will appear when the virtual machine is turned on, just select "No". Then wait for the installation to complete
After the installation is complete, you can log in to root
This installation method is a minimal installation, and the installed system only has a character interface
Login account: root Password: abc123
You can install it manually if you need a graphical interface
yum list
yum -y groupinstall "server with GUI"