Experiments (1): Deploying PXE Remote Installation Service
Batch deployment of servers
Scale-up: multiple servers at the same time
Automation: Installing systems and configuring services
Remote implementation: no installation media such as CD-ROM, U-disk, etc.
The basic steps of the experiment are as follows:
1, DHCP (Automatically Assign IP Address Location Boot File)
next-server // Point to TFTP Path
filename // Bootstrapper File Location
2. TFTP (simple file transfer protocol UDP:69 with high efficiency and small capacity) (bootstrapper pxelinux.0 (syslinux package), compression of kernel vmlinuz, system initialization file initrd.img, Startup menu default)
3. FTP (centos7) is secure and has large capacity for TCP:20 data transmission and 21:connection)
Installation packages required: dhcp, tftp-server, vsftpd, syslinux
The experimental environment:
A Linux Server as PXE Installation
A bare machine without system installed
(1) In order not to affect the use of NAT mode, we install a new network card for Linux server and set it to host-only mode. We also configure a fixed IP address for the new network card as the dhcp allocation address.
1. Add a new network card to the Linux server settings and set it to host-only mode
2. Configure new network card ens36 information
[root@localhost ~]#cd/etc/sysconfig/network-scripts/Copy a network card information as a configuration file for the new network card [root@localhost network-scripts]# cp -p ifcfg-ens33 ifcfg-ens36 [root@localhost network-scripts]#vim ifcfg-ens36 Configuration of new network card ens36 [root@localhost network-scripts]#System CTL restart network
(2) Install DHCP service and edit configuration file/etc/dhcp/dhcpd.conf
[root@localhost network-scripts]#yum install dhcp-y install DHCP service [root@localhost network-scripts]#cp/usr/share/doc/dhcp-4.2.5/dhcpd.conf.example/etc/dhcp/dhcpd.conf cp: Coverage or not"/etc/dhcp/dhcpd.conf"? y [root@localhost network-scripts]#vim/etc/dhcp/dhcpd.conf Edit DHCP configuration file
subnet 192.168.100.0 netmask 255.255.255.0 { range 192.168.100.20 192.168.100.30; option routers 192.168.100.100; option domain-name-servers 114.114.114.114; next-server 192.168.100.100; filename "pxelinux.0"; }
(3) Install syslinux, tftp services
1. Install syslinux and view the boot file pxelinux.0 location
[root@localhost network-scripts]#yum install syslinux-y install syslinux-y [root@localhost network-scripts]#rpm-ql syslinux | grep pxelinux viewing boot file location
2. Install the tftp service
[root@localhost network-scripts]#yum install tftp-server-y install TFTP service [root@localhost network-scripts]#rpm-ql tftp-server View File Location [root@localhost network-scripts]#vim/etc/xinetd.d/tftp to open the TFTP service
3. Copy boot file pxelinux.0 to / var/lib/tftpboot (in TFTP site)
[root@localhost network-scripts]#cp/usr/share/syslinux/pxelinux.0/var/lib/tftpboot copies boot files to the site [root@localhost network-scripts]#cd/var/lib/tftpboot/ Switch to the site to view [root@localhost tftpboot]# ls pxelinux.0
(4) Install vsftp service (connect centos7 mirror file to CD before installation), copy compressed kernel and initialization file to TFTP site
[root@localhost tftpboot]#yum install vsftpd-y install vsftp service [root@localhost tftpboot]# cd /var/ftp [root@localhost ftp]# mkdir centos7 [root@localhost ftp]# mount /dev/cdrom centos7/ [root@localhost ftp]# cd centos7/images/pxeboot/ [root@localhost pxeboot]# cp initrd.img vmlinuz /var/lib/tftpboot/ [root@localhost pxeboot]# ls /var/lib/tftpboot/
(5) Edit default configuration file of startup menu, close firewall and open three services
[root@localhost pxeboot]#Switch to tftp site cd/var/lib/tftpboot/ [root@localhost tftpboot]#mkdir pxelinux.cfg Create a configuration file directory [root@localhost tftpboot]# ls initrd.img pxelinux.0 pxelinux.cfg vmlinuz [root@localhost tftpboot]# cd pxelinux.cfg/ [root@localhost pxelinux.cfg]#vim default editing default configuration file [root@localhost pxelinux.cfg]#System CTL stop firewalld.service Close the firewall [root@localhost pxelinux.cfg]# setenforce 0 [root@localhost pxelinux.cfg]#System CTL start dhcpd Start three services [root@localhost pxelinux.cfg]# systemctl start tftp [root@localhost pxelinux.cfg]# systemctl start vsftpd
default auto prompt 1 label auto kernel vmlinuz append initrd=initrd.img method=ftp://192.168.100.100/centos7 label linux text kernel vmlinuz append text initrd=initrd.img method=ftp://192.168.100.100/centos7 label linux rescue kernel vmlinuz append rescue initrd=initrd.img method=ftp://192.168.100.100/centos7
(6) Create and open bare machines without installing systems, select network installing machines and install systems.
1. The bare machine that creates an uninstalled system needs to choose host-only mode
2. Open the bare machine without installation system and select network installation.
Successful deployment of pxe batch installation service!!!
Experiments (2): kickstart unattended Technology
Create response files (ks.cfg), pre-defined numbers, various installation settings
Free of interactive setup process to achieve full automation of installation
Complete various configuration operations after installation by adding% post script
(1) Install kickstart package and open the settings (except for the pictures I listed to be modified, the rest do not need to be modified)
[root@localhost ~]#yum install system-config-kickstart-y install kickstart software
1. Open kickstart to set up after installation
2. Setting up content information for installation
Basic configuration chooses Chinese language, time zone, root password, restart after installation
Installation method chooses FTP server and specifies the server's address
Set partition information, start directory / boot: 500M home directory / home: 4096M swap space swap: 4096M root directory /: all space allocated
Set network device information to ens33
Firewall set to disable
Fill in the interpreter for the installed script as / bin/bash
Save ks.conf to / var/ftp directory
(2) Copy the template of the installation package into ks.cfg, and introduce the loading template in / var/lib/tftproot to make it work.
1. Look at ks.conf and copy the package template from local anaconda-ks.cfg to ks.cfg
[root@localhost pxelinux.cfg]#ls/var/ftp Switch to/var/ftp to view saved ks.cfg configuration file centos7 ks.cfg pub [root@localhost pxelinux.cfg]#cd/root switch to local/root [root@localhost ~]# ls anaconda-ks.cfg initial-setup-ks.cfg public Template video picture File download Music desktop [root@localhost ~]#vim anaconda-ks.cfg copies the installation package module in anaconda-ks.cfg to ks.cfg under / var/ftp/. [root@localhost ~]# vim /var/ftp/ks.cfg
(3) Boot loading ks.cfg template to default configuration file under / var/lib/tftproot/pxelinux.cfg/.
[root@localhost ~]#cd/var/lib/tftpboot/pxelinux.cfg/Switch to/var/lib/tftpboot/pxelinux.cfg/directory [root@localhost pxelinux.cfg]# ls default [root@localhost pxelinux.cfg]#vim default editing
(4) Open the bare machine for installation system to see the effect of installation.
Direct skip the interactive interface and install the system directly, realize unattended installation
Thank you for reading!!!