Linux-Cobbler automatic deployment and installation

1. Cobbler automatically deploys and installs

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.

Two, experiment preparation

A Linux server (Centos7 system, IP: 192.168.80.134)
A blank virtual machine
needs to be connected to the Internet, and the virtual machines use NAT mode
related software packages: link: https://pan.baidu.com/s/1Cl2H_cufGmbHCWfs_mObCQ Password: desg

Cobbler automatic installation service construction steps

1. Import epel source

rpm --ivh epel-release-latest-7.noarch.rpm - install dependency package
yum list - automatically load online update source
Insert picture description here

2. 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 is used to quickly establish a Linux network installation environment
#dhcp is used to automatically assign IP addresses to blank hosts
#tftp-server provides boot image file download
# pykickstart realizes unattended installation
#httpd runs as a console program
#rsync realizes data synchronization
#xinetd provides access control, enhanced log and resource management functions
Insert picture description here

3. Modify the main configuration file of cobbler

vim /etc/cobbler/settings #Modify the
following items
next_server: 192.168.80.10 #Point to the IP of the tftp server, which is the local IP
server: 192.168.80.10 #Point to the IP of the cobbler server, which is the local IP
manage_dhcp: 1 #Let cobbler Manage dhcp service
manage_rsync: 1 #Let cobbler manage rsync service
manage_tftpd: 1 #Let cobbler manage tftp service
Insert picture description here

4. Start related services and close the firewall and selinux


①Start the service systemctl start httpd.service #Start the http service
systemctl start cobblerd.service #Start the cobbler service
systemctl stop firewalld.service
setenforce 0 ②Use the
Insert picture description here
cobbler check command to check the settings of Cobbler, and query items that need to be changed.
cobbler check
Insert picture description here

5. Turn on the tftp service and rsync service

①Modify the configuration file of tftp
vim /etc/xinetd.d/tftp
disable = no
Insert picture description here


②Start the service systemctl restart xinetd.service
systemctl start rsyncd.service
Insert picture description here

6. Download the boot operating system file

cobbler get-loaders
Insert picture description here

7. Set the initial password of the Cobbler user

①Use salt encryption to generate the key
openssl passwd -1 -salt'abc123''abc123'
can write the password of the root user after installing the system ②Add
Insert picture description here
the generated key to the Cobbler configuration file
Insert picture description here

8. Configure dhcp service


①Modify the template file vim /etc/cobbler/dhcp.template of Cobbler management dhcp service- modify the file
Insert picture description here

②Synchronize the configured template file to the configuration file of the DHCP service
cobbler sync ③Restart the
Insert picture description here
DHCP service
systemctl restart dhcpd.service
Insert picture description here

9. Import the ISO image file

Mount image file ①
Mount / dev / SR0 / mnt
Insert picture description here
② iso image introduced in the Linux kernel, initialization image file
cobbler import --path = / mnt / --name = CentOS-7-x86_64 --arch = x86_64
Parameters
- path represents the directory where the mirror is mounted
-name represents the name defined for the installation source
-atch represents 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
Insert picture description here


③Check whether the kernel and initialization files are in the shared directory of tftp-server yum install -y tree——the system is not installed by default, you need to manually install the tree
tree /var/lib/tftpboot/images——check whether the file exists
Insert picture description here

10. Restart all services

systemctl restart cobblerd.service
systemctl restart dhcpd.service
systemctl restart xinetd.service
systemctl restart httpd.service
Insert picture description here

11. Use cobbler check again to check settings for Cobbler

Insert picture description here

12. After all configurations are completed, turn on the blank host to automatically install the system

Insert picture description here
Insert picture description here
Insert picture description here

This installation method is a minimal installation, and the installed system only has a character interface.
Login account: root Password: abc123
Insert picture description here

13. If you need a graphical interface, you can install it manually

yum groupinstall “X Window System”
yum update grub2-common
yum install -y grub2-efi
yum install -y fwupdate
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch. rpm
yum groupinstall "GNOME Desktop"
ln -sf /lib/systemd/system/runlevel5.target /etc/systemd/system/default.target
ln -sf /lib/systemd/system/multi-user.target /etc/systemd/ system/default.target
ln -sf /lib/systemd/system/graphical.target /etc/systemd/system/default.target
reboot
After reboot , the following interface will appear
Insert picture description here
Insert picture description here

Insert picture description here
Insert picture description here

Guess you like

Origin blog.csdn.net/s15212790607/article/details/114140342