Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Realize the automatic installation of Centos6/7 by PXE

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

1. Configure DHCP server

Preparatory work:

1. Close selinux

2. Turn off the firewall

3. Synchronous clock

Step 1: install the package

Yum install dhcp

Rpm-ql dhcp

Step 2: start the service

Cannot start without configuration file

Check the systemctl status dhcp.service to determine the problem

Cp/ usr/share/doc/dhcp-4.2.5/dhcpd.conf.example / etc/dhcp/dhcpd.conf

Step 3: modify the configuration file: vim / etc/dhcp/dhcpd.conf Note: each line must have a semicolon

Subnet 172.31.0.0 netmask 255.255.255.0 {

Range 172.31.0.100 172.31.0.200

Option routers 172.31.0.254

Option domain-name-servers 114.114.114.114,8.8.8.8

Option domain-name "magedu.org"

Next-server 172.31.0.1;-tftp server address

Filename "pxelinux.0";-the name of the boot file to download. The default name is pxelinux.0

}

Systemctl start dhcpd

View port: ss-ntulp, port number is 68

Systemctl enable dhcpd

Test: check that the server is assigned address information:

Cat / var/lib/dhcpd/dhcpd.leases

Check the client to get the address information: / var/lib/dhclient/dhclient-eth2.leases

View port: ss-ntulp, port number is 69

Realize the allocation of information such as fixed addresses to some devices

Configure the tftp server

1. Installation package: yum install tftp-server

Note that centos6 is a non-independent service, and chkconfig tftp on; service xinetd start is required to start the service.

2. Query the list of installation files: rpm-ql tftp-server shared directory is: / var/lib/tftpboot startup service: systemctl start tftp.service Note: it is the separation of service and socket. If the service is stopped, port 69 is still in the listening state. View port: ss-ntulp, port number 69 client installation: yum install tftp Settings Boot: method 1: systemctl enable tftp

3. Configure http service

Cd / var/www/html/

Mkdir centos {6jue 7} / os/x86_64-pv

Mkdri ksdir/centos {6jue 7} /-p

Mount the 6x7 CD to the corresponding directory, save it to / etc/fstab, and mount it automatically.

Cp ks6.cfg ksdir/centos6/ Note: the http address written in the answer file needs to be on the same network segment as the dhcp service.

Cp ks7.cfg ksdir/centos7/ Note: the http address written in the answer file needs to be on the same network segment as the dhcp service.

Make sure syslinux is installed, rpm-ql syslinux | grep pxelinux.0

Rpm-ql syslinux | grep menu.c32

Prepare the files related to PXE startup: pexlinux.0,menu.32,vmlinux,initrd.img,pxelinux.cfg/default

Open the cd / var/lib/tftpboot directory

Cp / usr/share/syslinux/pxelinux.0 / var/lib/tftpboot/

Cp / usr/share/syslinux/menu.c32 / var/lib/tftpboot/

Mkdir / var/lib/tftpboot/centos {6,7}

Cp / var/www/html/centos/6/os/x86_64/isolinux/ {vmlinuz,initrd.img} / var/lib/tftpboot/centos6

Cp / var/www/html/centos/7/os/x86_64/isolinux/ {vmlinuz,initrd.img} / var/lib/tftpboot/centos7

Mkdir / var/lib/tftpboot/pxelinux.cfg

Cp / var/www/html/centos/7/os/x86_64/isolinux/isolinux.cfg / var/lib/tftpboot/pxelinux.cfg/default

Vim / var/lib/tftpboot/pxelinux.cfg/default New Virtual Machine Test Note: centos7 memory must be set to more than 1.5g

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report