Recently, I encountered a problem when deploying the environment on the customer’s site. Many servers of the customer did not install the system, and it was too tedious and time-consuming to deploy and install the system using the traditional cd-rom drive. Therefore, WE adopted kickstart batch installation under the PXE environment. Kickstart installed more than 30 server systems under PXE in less than an hour, saving nearly two hours from the original cd-rom installation and greatly improving the efficiency of system deployment. Below, I will share how to implement kickstart batch installation in PXE environment from the aspects of knowledge popularization, efficiency comparison and installation teaching.

Enjoy:

I. Sorting out relevant knowledge

1. Introduction to batch installation software:

There are two main installation methods for operating systems: Kickstart and Cobbler.

Kickstart is an unattended installation. It works by recording various parameters filled in by human intervention during installation and generating a file called ks.cfg. If parameters need to be filled in during automatic installation, the installation program will first search the ks. CFG file. If appropriate parameters are found, the found parameters will be used. If no suitable parameters are found, a dialog box will pop up for the installer to fill in manually. So, if the ks.cfg file covers all the parameters that need to be filled in during installation, the installer can simply tell the installer where to download the ks.cfg file. After the installation is complete, the installation program restarts/shuts down the system according to the Settings in ks. CFG and ends the installation. This batch installation is adopted in this way.

Cobbler centralizes and simplifies the configuration of DHCP, TFTP, and DNS services required to install an operating system over a network. Cobbler not only has a command line interface, but also provides a Web interface that significantly lowers the level of entry for users. Cobbler has a lightweight CONFIGURATION management system built in, but it also supports integration with other configuration management systems. I won’t go into details here.

2. Introduction to PXE

Preboot Execute Environment (PXE) is a standard developed by Intel to boot the system over the network.

The most straightforward aspect of PXE is that workstations can dispense with hard disks in a networked environment, but it is not the usual concept of a disk-free station, since PCS using PXE can run three times faster on the network than PCS with disks. Of course, A PC using PXE is not a TERMINAL in the traditional sense. The PC using PXE does not consume CPU and RAM resources of the server, so the hardware requirements of the server are very low.

3. Kickstart and PXE

The Kickstart implementation depends on the PXE environment. Start a computer through a network port, independent of the local storage device (such as a hard disk) or the locally installed operating system.

The PXE client invokes network protocols such as Internet Protocol (IP), User Datagram Protocol (UDP), Dynamic Host Configuration Protocol (DHCP) and Small File Transfer Protocol (TFTP). The term PXE client refers to the role of the machine in the PXE boot process. A PXE client can be a server, laptop, or other machine with PXE boot code (our computer’s network card).

4. Prerequisites for PXE

(1) PXE client must support the function of PXE client, and choose network boot when starting up, to ensure that the PXE boot program can be accessed through network;

(2) The PXE server must provide DHCP, TFTP, HTTPD (VSFTPD or NFS) services and meet the following requirements:

  • In addition to assigning IP addresses to PXE clients, the DHCP server also needs to inform pxelinux.0 of the location of TFTP files.

  • The TFTP server downloads important files such as bootloader and kernel for the PXE client

  • Use HTTPD server to provide pXE client program and software source (shared source)

Second, batch installation and traditional installation efficiency comparison

Batch PXE network deployment takes two parts: ** Double the system installation time and PXE environment deployment time. ** These two parts of time are relatively fixed.

Traditional CD/DVD-ROM deployment is determined by many factors, such as the number of CD/DVD-ROM drives, the number of deployed personnel, and other uncertain variables.

The PXE Kickstart deployment, with two o&M staff and two cd-rom drives, reduced installation time by 300 percent compared to a traditional deployment with 30+ server systems.

As a result, PXE requires less personnel, hardware, time, and flexibility than traditional cd-rom drives. Kickstart in PXE is a great way to improve efficiency and save time when you need to install a large number of servers.

Three, installation teaching

The first step is to prepare the service pack that the network deployment depends on. 六四运动

1. Rely on services

DHCP, TFTP, SYSLinux, HTTP (VSFTPD or NFS)

The second step is to install each dependent service and determine the service installation dependencies.

2. Rely on the RPM package

3. Install the DHCP service

The common and lib services are generally pre-installed on the server:

Yum install -y DHCP

RPM package installation (dependent order) :

If the DHCP service has been installed, run the RPM -ivh dhcp-4.2.5-82.el7.centos.x86_64. RPM command to install the DHCP service in common and lib

4. Install the TFTP service

Yum install -y TFTP

RPM package installation:

The RPM – the ivh TFTP server – 5.2-22. El7. X86_64. RPM

5. Install the syslinux

Yum install -y syslinux

RPM package installation:

The RPM – the ivh syslinux – 4.05-15. El7. X86_64. RPM

6. Install the HTTP service

Yum install -y HTTPD

RPM package installation (dependent order) :

The RPM – the ivh mailcap 2.1.41-2. El7. Noarch. RPM

The RPM – the ivh HTTPD – tools – 2.4.6-97. El7. Centos. X86_64. RPM

The RPM – the ivh HTTPD – 2.4.6-97. El7. Centos. X86_64. RPM

Previous: PXE installation dependent services have been configured

Follow-up: Configure services to implement unattended installation

Step 3: Configure associated services, such as DHCP, TFTP, SYSLinux and HTTP.

7. Configure the DHCP service

(1) Modify the configuration file

a) vim /etc/dhcp/dhcpd.conf

Subnet 192.168.0.0 netmask 255.255.255.0 {

The range 192.168.0.140 192.168.0.162;

Option subnet configures – mask 255.255.255.0.

default-lease-time 21600;

max-lease-time 43200;

Next – server 192.168.0.175;

filename “/pxelinux.0”;

}

Subnet: configure the subnet

Netmask: configure the subnet mask

Range: Configures the DHCP address pool

Option subnet-mask: sets the subnet mask of the address pool

Default-lease -time: indicates the default address lease period

Max-lease-time: indicates the maximum address lease period

Next-server: provides the boot file server IP (HTTP, VSFTPD, NFS)

Filename: specifies the filename of the initial boot file to be loaded for NIC booting

(2) Start the service

systemctl start dhcpd

8. Configure TFTP services

Start the service: systemctl start TFTP

TFTP root directory:

(1) View the configuration file

vim /etc/xinetd.d/tftp

(2) Check the root directory /var/lib/tftpboot

9. Syslinux service configuration

Function: Obtain the pxelinux.0 file for automatic boot network installation.

Preboot file

Path to the file: / usr/share/syslinux pxelinux. 0

Copy pxelinux.0 to /var/lib/tftpboot. Load Pxelinux.0 through TFTP.

cp -a /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot

10. Configure HTTP services

You do not need to configure the HTTP service. The default directory is /var/www/html

systemctl start httpd

11. System installation disk ISO file configuration (here based on HTTP, ISO mounted, image network access download)

(1) Copy the ISO file value of the CD-ROM drive to the local PC

/var/ WWW/HTML;

(3) Create directory: ‘*’, * can be arbitrarily defined, this paper create ‘centos7.6’

(4) Mount an ISO image:

The mount CentOS – 7 – x86_64 – Everything – 1708. Iso/var/WWW/HTML/centos7.6

12. Network boot configuration kernel loading module: vmlinuz, initrd.img, etc.

Copy content related to ISO file value TFTP root directory

Cp – a/var/WWW/HTML/centos7.6 / isolinux / * / var/lib/tftpboot /

13. System installation, configure the client PXE default boot image configuration file: default

(1) Access the TFTP root directory and create the pxelinux.cfg directory

cd /var/lib/tftpboot;

mkdir pxelinux.cfg

(2) Copy the ISO boot file to the upper-layer creation directory

Cp – a/var/WWW/HTML/centos7.6 / isolinux/isolinux CFG/var/lib/tftpboot/pxelinux CFG/default

cp -a /root/ anaconda-ks.cfg

14. System installation, configure the specified client PXE boot image configuration file: MAC

In the pxelinux. CFG directory, create an ISO installation file named after the MAC address of the client

Cp – a/var/WWW/HTML/centos7.6 / isolinux/isolinux CFG/var/lib/tftpboot/pxelinux CFG/aa – bb – 01-88-99 – cc – dd

15. Obtain the ks file anaconda-ks.cfg

After the Linux installation is complete, this file is automatically generated in the root directory

16. Configure the unattended installation file: anaconda-ks.cfg

HTTP configuration directory, create directory: ks_config

mkdir /var/www/html/ks_config

Copy the installation tree file to cp /root/anaconda-ks. CFG /var/www/html/ks_config

17. Modify the PXE boot image as the KS automatic installation tree file

vim /var/lib/tftpboot/pxelinux.cfg/default

Or vim/var/lib/tftpboot/pxelinux CFG/MAC

Specify the boot file installation tree configuration:

Ks =http://* or inst.ks=http://*

The default parameter name: method cannot be used. Otherwise, the boot fails and the ISO image file cannot be found

To implement automatic ks installation, specify the HTTP path as the ks file path.

ks=http://ip/ks\_config/anaconda-ks.cfg

/var/ WWW/HTML /ks_config/*.cfg; /var/ WWW/HTML /ks_config/*.cfg; /var/ WWW/HTML /ks_config/*.cfg; Also need to specify the corresponding generated client PXE boot image files, / var/lib/tftpboot/pxelinux CFG/MAC;

18. Ks file display

Be sure to specify the correct network protocol in the red box to boot the ISO image

19. Deploy and install

Power up the client and the installation will be automated

END

PS: More practical dry goods welcome to pay attention to the wechat public number “soft record number” ~