Configuration and implementation of Linux PXE

Source: Internet
Author: User

About PEX:

PXE (Preboot execute environment, pre-boot execution Environment) isIntel Corporationdevelopment of the latest technology, working in Client/server network mode, supportWorkstationdownload images from remote servers over the network and support booting over the networkOperating system, during the boot process, the terminal requires the server to assignIpaddress, then useTftp(Trivial File Transfer Protocol) orMtftp(Multicast trivial File Transfer Protocol) protocol download a bootSoftwarepackage to native memory execution, by this boot package complete terminal (customer? Basic software settings to boot the terminal operating system that is pre-installed in the server.


the basic working principle of PEX :

PEX typically requires 2 protocols: DHCP "Dynamic Host Configuration Protocol"

TFTP "Trivial File Transfer Protocol" Simple Text Transfer Protocol

PEX works in the network mode of C/s, i.e. terminal/server-side mode

When the terminal's network card is started, it will request an IP address from the DHCP server, take this IP address to the/var/lib/tftpboot directory on the TFTP server to download the required installation files, the terminal obtains the required files, executes the file, enters the system installation interface.


DHCP Configuration:

Download DHCP package using yum install DHCP, it will generate/etc/dhcp/dhcp.conf configuration file, 650) this.width=650; "Src=" http://s3.51cto.com/wyfs02/M01/ 42/c2/wkiom1pyv3yifjfmaaaqtd2ux0c041.png "title=" P1. PNG "alt=" Wkiom1pyv3yifjfmaaaqtd2ux0c041.png "/>

It will prompt you, you can follow the "man 4 dhcpd.conf" in the format, create a profile yourself, you can also edit according to/usr/share/doc/dhcp*/dhcpd.conf.sample template, as long as a configuration file to create a good.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/42/C2/wKioL1PYwV2CiU37AAAkc3KbTdk987.png "title=" 2.PNG " alt= "Wkiol1pywv2ciu37aaakc3kbtdk987.png"/> Such a configuration file,

You can use the command service DHCPD configtest to see the configuration file syntax with no errors.

Using the command service DHCPD start

You can see if Port 67th is turned on and listening, as shown in the boot success: 650) this.width=650; "Src=" http://s3.51cto.com/wyfs02/M01/42/C2/ Wkiom1pywz3jo2abaaalu4ucydq284.png "title=" 3.PNG "alt=" Wkiom1pywz3jo2abaaalu4ucydq284.png "/>

Test whether the DHCP service can run properly, then find a virtual machine, and the server and terminal are selected Vmnet3, to avoid external network interference,

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/42/C5/wKioL1PYxv6QgVfDAAA2RuW5Idc380.png "title=" 4.PNG " alt= "Wkiol1pyxv6qgvfdaaa2ruw5idc380.png"/>

Then restart the terminal's network services, service network restart

Then ifconfig view the IP address to see if the IP address is within the IP address segment established within the DHCP configuration file, as shown in the IP address of the terminal:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/42/C6/wKioL1PYx5ujfCZWAAAZYyeidJY945.png "title=" 5.PNG " alt= "Wkiol1pyx5ujfczwaaazyyeidjy945.png"/> Then look at the IP address segment specified by the DHCP configuration file, such as:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/42/C6/wKiom1PYxwrx_JaCAAAJS50DT3A999.png "title=" 6.PNG " alt= "Wkiom1pyxwrx_jacaaajs50dt3a999.png"/>

See no, Address field 30 to 40 and the IP of the terminal in this IP segment, this means that we have successfully configured,


The following is the configuration of TFTP ,

First, yum install TFTP,

Then, RPM-QL tftp to see if TFTP has generated those files, such as

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/42/C8/wKiom1PYx-3B5TIlAAAbAnyC88w486.png "title=" 7.PNG " alt= "Wkiom1pyx-3b5tilaaabanyc88w486.png"/>

Change the disable=yes in the TFTP config file to No

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/42/CB/wKiom1PYyknhhLdcAAAdxhHWp2k980.png "title=" 9.PNG " alt= "Wkiom1pyyknhhldcaaadxhhwp2k980.png"/>

Then use the #ss-UNL to see if Port 69th is up and ready to use.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/42/CB/wKioL1PYyvPimhKjAAAHIT1jM1U691.png "title=" 8.PNG " alt= "Wkiol1pyyvpimhkjaaahit1jm1u691.png"/>


Then, under the server-side/var/lib/tftpbo/directory, create a file A and enter simple content.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/43/68/wKioL1PaKKOjZS7vAAAXzlrXysw816.png "title=" 11.PNG "alt=" Wkiol1pakkojzs7vaaaxzlrxysw816.png "/>

Then on the terminal, the TFTP 172.16.249.14 (server address) can be used to enter the TFTP server,

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/43/68/wKiom1PaJ8OyaXzVAAAFcf9qtH8287.png "title=" 12.PNG "alt=" Wkiom1paj8oyaxzvaaafcf9qth8287.png "/>

Using get a to get a file in the root directory, if you can successfully prove that your TFTP service is configured,

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/43/68/wKioL1PaKRHB80yPAAAK8Th3uBY141.png "title=" 13.PNG "alt=" Wkiol1pakrhb80ypaaak8th3uby141.png "/>



PXE working environment

First to start the system, pxelinux.0 this file is necessary, it is syslinux This package is provided, so we install this package

Yum Install Syslinux

and copy this file to the Tftpboot directory of the TFTP server,

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


We also need to copy some of the core files in the CD to the Tftpboot directory,

Vmlinuz initrd.img splash.jpg, VESAMENU.C32, boot.msg

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/43/69/wKioL1PaLKaDX-RXAAAKitLj5eU759.png "title=" 16.PNG "alt=" Wkiol1palkadx-rxaaakitlj5eu759.png "/>

A very important operation is to copy, isolinux.cfg Config file to, pxelinux.0 directory and rename to default,

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

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/43/69/wKioL1PaK_fR-IMgAAA9iLyBfyM316.png "title=" 15.PNG "alt=" Wkiol1pak_fr-imgaaa9ilybfym316.png "/>


This points to the path to the KS configuration file for automatic installation. It may not be written in the default file, but should be pointed out manually at startup.



The final step is to specify the system installation source, where I am using the HTTP service,

So the first step is to install first, HTTP

Yum Install httpd

And then under this service directory/var/www/html/create a directory named CentOS,

Bind this directory with the directory attached to the CD,

Mount--bind/media/cdrom/var/www/html/centos

This will make it possible to access the contents of the CD in the CentOS directory. 650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/43/68/wKiom1PaLUKhQCUeAABVDiyKlCM168.png "title=" 17.PNG "alt=" Wkiom1palukhqcueaabvdiyklcm168.png "/>

Come on, let's take a look at this. configuration file, Ks.cfg, function: Provides the system configuration file, and is automatically read by the installation program.


650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/43/68/wKiom1PaLdyySS3oAAAfxiFWvig701.png "title=" 18.PNG "alt=" Wkiom1paldyyss3oaaafxifwvig701.png "/>

It defines the parameters of the configuration system, enabling the installation to be automated


Server configuration ready, let's see how the terminal to use the network card to start, automated installation of it,

I created a new virtual machine, which is based on the DHCP protocol to find the server, request an IP address,

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/43/69/wKiom1PaL7Gwn_moAAAj_1TE8IM436.png "title=" 19.PNG "alt=" Wkiom1pal7gwn_moaaaj_1te8im436.png "/> Now into the installation interface, is not, 650) this.width=650;" Src= "http://s3.51cto.com/ Wyfs02/m02/43/69/wkiol1pambzhfru1aantbtl89sk333.png "title=" 20.PNG "alt=" wkiol1pambzhfru1aantbtl89sk333.png "/ >

Press ENTER and it will be installed automatically, and PXE will say it, (T t)!









This article is from the "Linux Small Pot Friends" blog, please be sure to keep this source http://ny0716.blog.51cto.com/9154254/1533421

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.