Detailed tutorial on how to automatically install CentOS7.6 using PXE

Detailed tutorial on how to automatically install CentOS7.6 using PXE

1. Demand

The base has 300 new servers, and needs to install the CentOS7.6 operating system by itself. Choose to use PXE for batch installation.

2. Preparation

Use a Layer 2 switch to connect servers that do not have an operating system installed to avoid affecting normal servers on the existing network.

Upload the operating system image to the server and install the necessary services for the PXE environment.

Mount the image file as a local software repository.

Environment Preparation

systemctl stop firewalld # Turn off the firewall setenforce 0 # Temporarily set SELINUX to loose mode sed -i '/^SELINUX=/s/.*/SELINUX=disabled/' /etc/selinux/config # Permanently disable SELINUX (requires reboot to take effect)
mkdir -p /var/www/html/CentOS1810/
mount /tmp/CentOS-7-x86_64-DVD-1810.iso /var/www/html/CentOS1810
mkdir /etc/yum.repos.d/backup 
mv /etc/yum.repos.d/{*,backup} # ignore the error message cat >/etc/yum.repos.d/local.repo<<EOF
[local_repo]
name=local_repo
baseurl=file:///var/www/html/CentOS1810
gpgcheck=0
EOF
yum clean all && yum makecache 
yum install httpd dhcp xinetd tftp-server syslinux -y

3. Service Configuration

Configure DHCP service

Modify the dhcp server configuration file

mv /etc/dhcp/dhcpd.conf{,.bak} # Back up the default configuration file cat>/etc/dhcp/dhcpd.conf<<EOF
subnet 10.0.0.0 netmask 255.255.255.0 { # Define the allocated network segment and mask range 10.0.0.1 10.0.0.252; # Define the allocated address range next-server 10.0.0.253; # Specify the server IP address of the boot file filename "pxelinux.0"; # Specify the boot file name}
EOF
systemctl start dhcp
systemctl enable dhcp
ss -nltup |grep :67

Configure tftp-server

Edit /etc/xinetd.d/tftp file

sed -i '/disable/s/yes/no/' /etc/xinetd.d/tftp
systemctl start xinetd
systemctl enable xinetd
ss -nltup |grep :69

Copy the relevant files to the default home directory of the tftp service

mkdir /var/lib/tftpboot/pxelinux.cfg 
cp -a {/var/www/html/CentOS1810/isolinux/*,/usr/share/syslinux/pxelinux.0} /var/lib/tftpboot/ # Copy the boot menu and boot loader cp -a /var/www/html/CentOS1810/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default

Summarize

The above is a detailed tutorial on how to automatically install CentOS7.6 using PXE. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!
If you find this article helpful, please feel free to reprint it and please indicate the source. Thank you!

You may also be interested in:
  • Detailed explanation of PXE+Kickstart unattended installation of operating system under CentOS 6.4
  • How to automatically deploy Linux system using PXE
  • VMware implements the detailed process of PXE+kickstart unattended installation of Centos7 system
  • PXE kickstart automated deployment system installation

<<:  Three examples of nodejs methods to obtain form data

>>:  Analyze the sql statement efficiency optimization issues of Mysql table reading, writing, indexing and other operations

Recommend

Eight examples of how Vue implements component communication

Table of contents 1. Props parent component ---&g...

VSCode+CMake+Clang+GCC environment construction tutorial under win10

I plan to use C/C++ to implement basic data struc...

Sample code for implementing horizontal infinite scrolling with pure CSS3

The examples in this article are all written in s...

How to implement scheduled backup of MySQL database

1. Create a shell script vim backupdb.sh Create t...

Docker-compose installation yml file configuration method

Table of contents 1. Offline installation 2. Onli...

Solve the mysql user deletion bug

When the author was using MySQL to add a user, he...

How to view and execute historical commands in Linux

View historical commands and execute specified co...

Detailed steps for installing MySQL using cluster rpm

Install MySQL database a) Download the MySQL sour...

How to prohibit vsftpd users from logging in through ssh

Preface vsftp is an easy-to-use and secure ftp se...

js regular expression lookahead and lookbehind and non-capturing grouping

Table of contents Combining lookahead and lookbeh...

A brief discussion on the use of GROUP BY and HAVING in SQL statements

Before introducing the GROUP BY and HAVING clause...