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

A brief analysis of adding listener events when value changes in html input

The effect to be achieved In many cases, we will ...

Using an image as a label, the for attribute does not work in IE

For example: Copy code The code is as follows: <...

How to open MySQL binlog log

binlog is a binary log file, which records all my...

MySQL 8.0.19 installation and configuration tutorial under Windows 10

I will be learning MySQL next semester. I didn...

Implementation of a simple login page for WeChat applet (with source code)

Table of contents 1. Picture above 2. User does n...

8 Reasons Why You Should Use Xfce Desktop Environment for Linux

For several reasons (including curiosity), I star...

How to avoid the trap of URL time zone in MySQL

Preface Recently, when using MySQL 6.0.x or highe...

An example of how Tomcat manages Session

Learned ConcurrentHashMap but don’t know how to a...

A brief talk about JavaScript Sandbox

Preface: Speaking of sandboxes, our minds may ref...

MySQL merge and split by specified characters example tutorial

Preface Merging or splitting by specified charact...

Mycli is a must-have tool for MySQL command line enthusiasts

mycli MyCLI is a command line interface for MySQL...

How to remove the blue box that appears when the image is used as a hyperlink

I recently used Dreamweaver to make a product pres...

How to shrink the log file in MYSQL SERVER

The transaction log records the operations on the...

HTML+VUE paging to achieve cool IoT large screen function

Effect demo.html <html> <head> <me...