In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
CentOS 7 how to install PXE server, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can gain something.
The first step
Test whether you have Internet access: ping www.baidu.com
Update yum warehouse source: yum repolist
Step two
Install dhcpd, tftp, syslinux, wget, and vsftpd
Enter yum install-y dhcp tftp tftp-server syslinux wget vsftpd
Step three
Turn off SELinux and firewall
Manually modify / etc/selinux/config to ensure SELINUX=permissive
Setenforce 0
Systemctl disable firewalld
Systemctl stop firewalld
Poweroff
The fourth step
Set the virtual machine's network adapter to "host mode" vmnet0 in VMWARE
Edit, virtual network editor, vmnet0, uncheck, that is, local dhcp servers are not allowed to assign ip
Step five
At this time, there is no need to surf the Internet, so you can set the IP address for CentOS 7 at will.
Nmcli con show
Nmcli con modi ens32 ipv4.method manual ipv4.addresses 192.168.1.1/24
# my Nic interface id is ens32. So set its IP to 192.168.1.1
Nmcli con up ens32
Nmcli con show
Ip a
# confirm that 192.168.1.1 has been successfully set
Step six
Set up the dhcp server
Vim / etc/dhcp/dhcpd.conf
Ensure that the configuration file is as follows:
Ddns-update-style interim
Ignore client-updates
Authoritative
Allow booting
Allow bootp
Allow unknown-clients
# A slightly different configuration for an internal subnet.
Subnet 192.168.1.0 netmask 255.255.255.0
{
Range 192.168.1.2 192.168.1.253
Option domain-name-servers 192.168.1.1
Option domain-name "server1.example.com"
Option routers 192.168.1.1
Option broadcast-address 192.168.1.255
Default-lease-time 600
Max-lease-time 7200
# PXE SERVER IP
Next-server 192.168.1.1; # DHCP server ip
Filename "pxelinux.0"
}
At this point, the pxelinux.0 referred to in the filename above has not yet been deployed. Eventually its location is / tftpboot/pxelinux.0, but don't use the path here, just use that name. Each line above ends with a semicolon (;).
Step 7
Configure the TFTP server for xinetd, leaving the tftp service to xinetd to manage
Vim / etc/xinetd.d/tftp
/ etc/xinetd.d/tftp is as follows:
Service tftp
{
Socket_type = dgram
Protocol = udp
Wait = yes
User = root
Server = / usr/sbin/in.tftpd
Server_args =-s / tftpboot
Disable = no
Per_source = 11
Cps = 100 2
Flags = IPv4
}
We are going to move the location of the tftp service to / tftpboot, and there will be a program that still thinks its path is in / var/lib/tftpboot, so change it back.
Vim / usr/lib/systemd/system/tftp.service
ExecStart=/usr/sbin/in.tftpd-s / var/lib/tftpboot
Modified to: ExecStart=/usr/sbin/in.tftpd-s / tftpboot
Look, only in this way can we be consistent with the corresponding content in / etc/xinetd.d/tftp
Step 8
Set up the TFTP server network startup file. The first step is to create a path / tftpboot
Mkdir / tftpboot
Chmod 777 / tftpboot
Cp-v / usr/share/syslinux/pxelinux.0 / tftpboot
Cp-v / usr/share/syslinux/menu.c32 / tftpboot
Cp-v / usr/share/syslinux/memdisk / tftpboot
Cp-v / usr/share/syslinux/mboot.c32 / tftpboot
Cp-v / usr/share/syslinux/chain.c32 / tftpboot
Create two more paths:
Mkdir / tftpboot/pxelinux.cfg
Mkdir / tftpboot/netboot/
Step 9
Publish the ISO file of CentOS to the folder of FTP. To do this, you must have an ISO file for CentOS 7. I want to mount it to the virtual machine in the form of a virtual CD
Click the CD icon at the bottom right of the screen and select "Connect to Host" in the short menu.
Lsblk
Check the path where the CD is mounted, such as sr0 / run/media/root/CentOS 7 x86x64
Mkdir-p / var/ftp/pub
Cp-r / run/media/root/'CentOS 7 x86 "64" Universe * / var/ftp/pub
"CentOS 7 x86x64" should be enclosed in quotation marks, otherwise it will make an error.
Cp-r / run/media/root/CentOS 7\ x8631 / var/ftp/pub *
Step 10
Copy the image files you need to use at startup to the directory location
Cp / var/ftp/pub/images/pxeboot/vmlinuz / tftpboot/netboot/
Cp / var/ftp/pub/images/pxeboot/initrd.img / tftpboot/netboot/
Step 11
Create a kickstart, the unattended installation file, named ks.cfg
Vim / var/ftp/pub/ks.cfg
Its contents are as follows:
# platform=x86, AMD64, or Intel EM64T
# version=DEVEL
# Firewall configuration
Firewall-disabled
# Install OS instead of upgrade
Install
# Use NFS installation media
Url-url= "ftp://192.168.1.1/pub/"
Rootpw-plaintext 123456
# set the password for root to 123456
# Use graphical install
Graphical
Firstboot disable
# System keyboard
Keyboard us
# System language
Lang en_US
# SELinux configuration
Selinux disabled
# Installation logging level
Logging level=info
# System timezone
Timezone Asia/Shanghai
# System bootloader configuration
Bootloader location=mbr
Clearpart-all-initlabel
Part swap-asprimary-fstype= "swap"-size=1024
Part / boot-fstype xfs-size=200
Part pv.01-size=1-grow
Volgroup rootvg01 pv.01
Logvol /-- fstype xfs-- name=lv01-- vgname=rootvg01-- size=1-- grow
% packages
@ core
Wget
% end
% post
% end
After saving, use ksvalidator to check for syntax errors
Ksvalidator / var/ftp/pub/ks.cfg
Step 12
Create a pxe menu
Vim / tftpboot/pxelinux.cfg/default
The default is as follows:
Default menu.c32
Prompt 0
Timeout 30
MENU TITLE Togogo.net Linux Training
LABEL centos7_x64
MENU LABEL CentOS 7 X64
KERNEL / netboot/vmlinuz
APPEND initrd=/netboot/initrd.img inst.repo= ftp://192.168.1.1/pub ks= ftp://192.168.1.1/pub/ks.cfg
The last APPEND is written on one line, and don't break the line in the middle.
Step 13
Systemctl enable dhcpd
Systemctl enable tftp
Systemctl enable vsftpd
Set the above services to boot automatically
Systemctl restart vsftpd
Systemctl restart dhcpd
Systemctl restart tftp
Restart the above services
Verification
Create a new virtual machine in VMware to act as a client for authenticating the PXE server. Set the network connection of its network adapter to Host Mode
Then start the virtual machine. As a result, we can see that this virtual machine can install CentOS Linux's Minimal without human intervention, that is, minimize installation
The difficulty that may be encountered in this process is to put the PXE client and the PXE server on the same network segment. If we surf the Internet at home, the IP address of the physical network card may be 192.168.1.X, then we can follow the above steps completely.
If the IP address of the physical network card is 192.168.0.X, or something else, manually modify the IP of the network card to change it to 192.168.1.X. Because the bridge setting of VMware will allow the "PXE client" to obtain the IP address of the 192.168.1.0 IP 24 network segment, which is exactly the same as the "PXE server"
Summary of error situation
1. Yum installation is not successful
The first step of yum installation, did not succeed, but ignored it. It is possible that: 1) another warehouse exists in the / etc/yum.repos.d directory and cannot be used. It needs to be disable or deleted. 2) unable to surf the Internet. Ping www.baidu.com shows that the target cannot be found.
Yum repolist
2. The IP address 192.168.1.1 of the PXE server is not modified.
10.xx.xxx.xx
3. / var/ftp/pub/images/pxeboot/vmlinuz and initrd.img are not copied to / tftpboot/netboot
4. / tftpboot/pxelinux.cfg/default content is incomplete
5. / SELINUX=disable in etc/selinux/config, the correct one should be disabled
6. Vsftpd configuration does not allow anonymous login, which makes the client unable to download the required installation files.
7. Not set to "bridging mode"
8. ISO is still used in the tested client to install
The hard drive is full
Set up the network of the PXE server
1) Settings in PXE server
Nmcli con show
Nmcli con modi ens33 ipv4.method manual ipv4.addresses 192.168.1.1/24
Nmcli con up ens33
Ip a
Confirm that the address of ens33 is 192.168.1.1
2) Settings on the physical machine
Change the setting of the physical network card to fixed IP
IP address: 192.168.1.2
Subnet mask: 255.255.255.0
Gateway: 192.168.1.1
3) setting of VMware
Set the network of the PXE server virtual machine to bridging mode in VMware
Restore the network of the PXE server
1) change the physical Nic to obtain the IP address automatically
2) set the network of the PXE server virtual machine to "NAT mode" in VMware
3) Settings in PXE server
Ip a-192.168.1.1
Nmcli con show
Nmcli con modi ens33 ipv4.method auto
Nmcli con up ens33
Ping www.baidu.com
Yum install syslinux-> pxelinux.0
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.