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

How to deploy PXE Network in Linux

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly introduces the relevant knowledge of how to deploy the PXE network in Linux, the content is detailed and easy to understand, the operation is simple and fast, and has a certain reference value. I believe you will gain something after reading this article on how to deploy the PXE network in Linux. Let's take a look.

PXE (Pre-boot Execution Environment) is a protocol designed by Intel that enables computers to start over the network. The network mode based on Client/Server supports workstations to download images from remote servers through the network, and thus supports starting the operating system through the network. When the computer is booted, BIOS calls the PXE client into memory and displays the command menu. After being selected by the user, PXE client will download the remote operating system to run locally through the network.

1. Configure the yum source and install the dhcp service

Cat / etc/yum.repos.d/my-source.repo

[my-source]

Name=Red Hat Enterprise Linux basearch-my source

Baseurl= file:///media

Enabled=1

Gpgcheck=1

Gpgkey= file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

Mount / dev/cdroom / media

Yum-y instasll dhcp

Yes | find /-name dhcpd.conf.sample-exec cp-p {} / etc/dhcp/dhcpd.conf

Filter comment lines: grep-v ^ #

Edit dhcpd.conf to add the following: ddns-update-style interim; ignore client-updates; subnet 192.168.1.0 netmask 255.255.255.0 {option routers 192.168.1.124; option subnet-mask 255.255.255.0; next-server 192.168.1.124; filename "pxelinux.0"; range 192.168.1.200 192.168.1.220; default-lease-time 600; max-lease-time 7200;} start the dhcp service:

/ etc/init.d/dhcpd start

Starting dhcpd: [OK]

2. Install the tftp service

Yum search tftp; yum-y install tftp-server

Chkconfig tftp on; / etc/init.d/xinetd restart

Test tftp: tftp 192.168.1.124

Tftp > get filename

3. Deploy the installation source

Yum-y install nfs*;/etc/init.d/rpcbind start

Echo "/ media * (sync,ro)" > > / etc/exports; / etc/init.d/nfs star

View shared information:

Exportfs-v

Test mount:

Mount.nfs 192.168.1.124:/media/ / opt/test

Source for using ftp: start vsftp;mount / dev/cdroot / var/ftp/pub/linuxos

4. Deploy the PXE environment

To get the Pxelinux.0 file, you need to install the pxelinux package

Yum search pxelinux;yum-y install yum search pxelinux

Mkdir / var/lib/tftpboot/pxelinux.cfg

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

Cp / media/images/pxeboot/ {vmlinuz,initrd.img} / var/lib/tftpboot/

Cp / media/isolinux/isolinux.cfg / var/lib/tftpboot/pxelinux.cfg/default

Modified default file:

Default linux

Prompt 1

Timeout 10

Display boot.msg

Menu background splash.jpg

Menu title Welcome to Red Hat Enterprise Linux 6.1!

Menu color border 0 # ffffffff # 00000000

Menu color sel 7 # ffffffff # ff000000

Menu color title 0 # ffffffff # 00000000

Menu color tabmsg 0 # ffffffff # 00000000

Menu color unsel 0 # ffffffff # 00000000

Menu color hotsel 0 # ff000000 # ffffffff

Menu color hotkey 7 # ffffffff # ff000000

Menu color scrollbar 0 # ffffffff # 00000000

Label linux

Menu label ^ Install or upgrade an existing system

Menu default

Kernel vmlinuz

Append initrd=initrd.img ks= ftp://192.168.1.124/pub/ksfile/ks.cfg

5. Configure the ks.cfg file

Yum-y install system-config-kickstart

Run system-config-kickstart

System-config-kickstart

Basic Configuration:

Select time zone, do not use UTC clock, set root password Encrypt root password, architecture x86

Choose to restart the system after installation

Installation Method

Perform a new installation, configure the installation source:

Method 1: FTP Server: 192.168.1.124 FTP Directory: / pub/linuxos

Method 2: NFS Server:192.168.1.124 NFS Directory: / media

Boot Loader Options

GRUB password can be set by default.

Partition Information

Clear master boot record, delete all existing partitions, initialize disk labels, layout partitions

Minimum installation package option:

@ core

@ server-policy

6. Prepare for installation

Place the ks.cfg in the / var/ftp/pub/ksfile/ directory and mount the installation source in the / var/ftp/pub/linuxos directory.

Lftp 192.168.1.124 confirms that all can be accessed anonymously (turn off selinux and firewall).

7. Test the installation

Under the same switching network, start the power supply of the system to be installed and start the installation.

Note:

Some servers with multiple network interfaces may not assign eth0 to the first network interface like the firmware interface, which may cause the installer to try to use a different network interface than the one used by PXE. To change this behavior, use the following in the pxelinux.cfg/* configuration file:

IPAPPEND 2APPEND ksdevice=bootif

The above configuration options allow the installer to use the same network interface as the firmware interface used by PXE. You can also use the following options:

Ksdevice=link

This option allows the installer to use the link it finds to the first network device transferred to the network.

Attached: ks.cfg

+ View Code

This is the end of the article on "how to deploy a PXE network in Linux". Thank you for reading! I believe you all have a certain understanding of "how to deploy PXE network in Linux". If you want to learn more, you are welcome to follow the industry information channel.

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

Development

Wechat

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

12
Report