Linux network service--PXE network batch installation + Kickstart unattended

1. System installation introduction

1.1 Three booting methods for system installation

1. Hard disk
2. Optical drive
3. Network

1.2 System installation process

  • load bootloader
  • load boot installer menu
  • Load the kernel and initrdxt
  • mount the root system
  • Run the anaconda installation wizard

2. Introduction to PXE

2.1 What is PXE

PXE is a network boot technology developed by inter company, working in client/server mode, allowing the client to download the boot image from the remote server through the network, and load the installation file or the entire operating system

PXE is booted through the network card

2.2 Advantages of PXE service

1. Scale: install multiple servers at the same time, no need to install operating programs for each one separately
2. Automation: realize automatic installation of servers and automatic configuration of various services
3. Remote implementation: no CD, U disk and other installation media are required, which is convenient It is fast and can guarantee the security of the server at the same time.

2.3 Requirements for building a PXE network system

1. Client

  • The network card of the client must support the PXE protocol
  • Network card comes with DHCP service and TFTP service
  • The motherboard supports network booting, and some of them need to be allowed to boot from the network or lan in the bios settings

2. Server

  • Configure the DHCP server: automatically assign addresses to clients, and specify the location of the boot file
  • The server should open the TFTP service: used to provide the download of the system kernel and boot image files
  • Install package sysinux: Provides PXE bootloader
  • The server provides FTP service: provide installation source

2.4 Four major files required for pxe installation

  • pxelinux.0: Bootloader
  • default: configuration file for the bootloader
  • vmlinuz: kernel file
  • initrd.img; system boot image file

2.5 PXE implementation process explanation

1. The network card of the client computer searches for the relevant dhcp server
2. The dhcp server assigns the ip address and the address of the boot program to the client computer, and at the same time sends the address of the tftp server to the client computer through an offer message 3. The tftp server sends the boot file to the
client Client
4. The client loads the boot program into the memory.
5. The boot program searches for the configuration file in the TFtp server, and the server sends the configuration file to the client.
6. The server installs and starts the vstpd service, and the client uses the ftp service to obtain it. system image file

insert image description here

3. Detailed explanation of services during construction

PXE remote installation server integrates centos7 installation source, tftp service, dhcp service, can send PXE boot program, linux kernel, boot menu and other data to the blank client, and provide installation files

Network card comes with dhcp service and tftp service

3.1DHCP service

DHCP is a LAN network protocol, which refers to a range of ip addresses controlled by the server. When the client logs in to the server, it can automatically obtain the ip address and subnet mask assigned by the server.

3.2TFTP service

  • tftp (Trivial File Transfer Protocol) is a simple file transfer protocol between client and server based on udp protocol. It is suitable for small file transfer applications. It is managed by xinetd service by default and uses udp69 port.
  • The TFTP service is generally only used in the installation scenario, and is used to transfer the kernel and boot files, because the security is not high
  • Built-in site: /var/lib/tftpboot

3.3syslinux

syslinux is a powerful boot loader and is compatible with various media. Its purpose is to simplify the time of installing linux for the first time, and to create a repair or other special-purpose boot disk. Its installation is very simple. Once sysinux is installed After that, the sysLinux boot disk can boot various dos-based tools, as well as ms-dos/windows or any other operating system
After installing the syslinux program, you can get the pxelinux.0 file

3.4vsftp: How to obtain the image file of the installation system

You can use http, ftp, etc., a type of ftp file transfer, and vsftpd is one of the software that provides ftp services

4. PXE network installation process

Experimental environment:
server intranet ip address: 192.168.11.11
DHCP, TFTP, FTP services are all set up on this server

Simple process:

1. Install 4 software packages: dhcp, tftp-server, vsftpd, syslinux (get the prelinux.0 file).
2. Configure the DHCP server, assign an IP address, and specify the address of the tftp server. (The virtual machine needs to enable the host-only mode to simulate the intranet environment)
3. Edit the TFTP service configuration file and enable the service (default is off).
4. Mount the software installation source (usually use the installation source in the CD, that is, mount the CD-ROM drive), and copy the three major files into the /var/lib/tftpboot/ directory first: pxelinux.0, vmlinuz, initrd .img.
5. In the /var/lib/tftpboot/ directory, create a subdirectory pxelinux.cfg, and write the configuration file default of the boot program in the subdirectory.
6. Turn off the firewall and selinux. Start dhcpd, tftp, vsftpd.
7. Use a blank client (bare metal) to test whether it can be installed automatically.

1. Server configuration steps
1. Install four software packages: dhcp, tftp-server, vsftpd, syslinux
insert image description here
2. Assign ip address and specify tftp address
insert image description here

insert image description here
3. Modify the TFTP service configuration file /etc/xinetd.d/tftp, enable the service (default disabled)
insert image description here
4. Mount the CD to the subdirectory centos7 of /var/ftp, and copy the three major files into /var/ In the lib/tftpboot/ directory: vmlinuz, initrd.img pxelinux 0.

insert image description here
insert image description here
5. In the /var/lib/tftpboot/ directory, create a subdirectory pxelinux.cfg, and write the bootloader configuration file default in the pxelinux.cfg directory

insert image description here
6. Turn off the firewall and selinux. Start dhcp, tftp, vsftpd three services
insert image description here
2. Client, create a blank virtual machine to test whether it can be installed automatically
1. Create a new blank virtual machine
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here
2. Start the virtual machine:
the virtual machine automatically obtains the ip address, automatically installs the mirror file system, Finally, a graphical interface appears, and then the parameters need to be manually configured
insert image description here

Guess you like

Origin blog.csdn.net/fyb012811/article/details/132168043