How to configure PXE for Linux

Source: Internet
Author: User

Linux system installation is a common problem in our work, we can easily use the CD-ROM to install the project, but for a lot of host installation situation when we are using a manual installation of a CD-ROM is a very frustrating thing, PXE installation solves this problem, To implement a PXE installation in our network to have a DHCP server, TFTP service, the source of installation system, provide the boot kernel files, implement the automated installation of the **.cfg file, the following we will separate these services (centos6.5).

One: DHCP server configuration


The Dynamic Host Provisioning Protocol (PROTOCOL, DHCP) is a local area network protocol that uses the UDP protocol to work with two main uses:

    • Automatically assign an IP address to a user to an internal network or network service provider

    • To the internal network administrator as a means of central management of all computers

1) Install the DHCP server

Host configured yum source after installing DHCP server yum install DHCP

After the installation is complete, check the installation situation: RPM-QL dhcp|less

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/42/A4/wKioL1PYm5DzAmO-AAFXBbS03ls203.jpg "title=" Query Dhcp.png "alt=" Wkiol1pym5dzamo-aafxbbs03ls203.jpg "/>

2) Configure the address pool and boot kernel address information

To implement the DHCP service, you must configure/etc/dhcp/dhcpd.conf.

For a newly installed DHCP server we can replicate cp/usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample/etc/dhcp/dhcpd.conf

After configuration we can use service DHCPD configtest to check the syntax of the dhcpd.conf if there is no problem we can start the DHCP service.


650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/42/A4/wKiom1PYmuLRHgQcAAD6uJXuRWE161.jpg "title=" DHCP configuration. png "alt=" wkiom1pymulrhgqcaad6ujxurwe161.jpg "/>

3) Start the DHCP server

At this point we can start the DHCP service DHCPD start, after the start of the query there is no corresponding port

Ss-unl

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/42/A9/wKioL1PYny-Tgs44AADR4U-X9jE898.jpg "title=" Dhcp2.png "alt=" Wkiol1pyny-tgs44aadr4u-x9je898.jpg "/>

Two: Configuring the TFTP server


The TFTP (Trivial file Transfer Protocol, simple Files Transfer Protocol) is a protocol used by the TCP/IP protocol family to perform simple file transfer between the client and server, providing an uncomplicated, inexpensive file transfer service with a port number of 69.

Why provide a TFTP server, the provision of TFTP server is mainly to provide the host to install the boot kernel files, we choose the network card after installation, The network adapter will actively connect to the TFTP server in the network (the NIC comes with a TFTP connector) to download the kernel boot file through the IP address and configuration information provided by the DHCP server on the Web.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/42/AD/wKiom1PYodbwBvBtAACXy0VUx3k725.jpg "title=" principle. png "alt=" Wkiom1pyodbwbvbtaacxy0vux3k725.jpg "/>


1) Installing the TFTP server

Yum Install TFTP

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/42/AF/wKioL1PYpInRRInxAAB-rskzvo8343.jpg "title=" yum Install Tftp1.png "alt=" Wkiol1pypinrrinxaab-rskzvo8343.jpg "/>

Since the TFTP server is a very small process, there are very few processes accessing it in the network, so we are handing the TFTP process to the Super Daemon for unified management. This super daemon is xinetd. So this super daemon will definitely be loaded when the TFTP service is installed.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/42/B1/wKiom1PYpO2wBqQrAAC3iKhWQpQ345.jpg "title=" Standalone daemon 3.png "alt=" Wkiom1pypo2wbqqraac3ikhwqpq345.jpg "/>

2) Open the TFTP service

To open the TFTP service effectively you must ensure that the Super Daemon xinetd is turned on, and the Super Daemon is turned on by default. Open the TFTP service

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/42/B2/wKioL1PYpu2SytyLAABYiyXFNJ8254.jpg "title=" Open Tftp5.png "alt=" Wkiol1pypu2sytylaabyiyxfnj8254.jpg "/>

View the TFTP process port number below

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/42/B3/wKioL1PYp4eQJs1iAADQoqgnFNc272.jpg "title=" Tftp69 Port 7.png "alt=" Wkiol1pyp4eqjs1iaadqoqgnfnc272.jpg "/>

Three: Configuring the PXE working environment

Copy/usr/share/syslinux/pxelinux.0 to/var/lib/tftpboot

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/42/C0/wKioL1PYslLQrDSpAACSh2g2Dxc277.jpg "title=" Pxelinu0 in tftp 1.2.png "alt=" Wkiol1pysllqrdspaacsh2g2dxc277.jpg "/>

IV: Provide boot installation kernel files


1) Mount the CentOS installation disk

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/42/B5/wKiom1PYqKbg8iUfAAOH-KrTbPU675.jpg "title=" Configure Cdrom3.png "alt=" Wkiom1pyqkbg8iufaaoh-krtbpu675.jpg "/>


Mount the installation disk to/media/cdrom

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/42/B6/wKioL1PYqh-wIKn1AAJluhHCPgo055.jpg "title=" Mount Cdrom4.png "alt=" Wkiol1pyqh-wikn1aajluhhcpgo055.jpg "/>

Open the installation disk with the boot kernel files we need and the graphics frame at the time of installation

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/42/B7/wKioL1PYquKT0RXbAAMYLm8tlmY444.jpg "title=" Iso-x86_64.png "alt=" Wkiol1pyqukt0rxbaamylm8tlmy444.jpg "/>


2) Create a selection screen at the beginning of the installation

Create the Pxelinux.cfg folder under/var/lib/tftpboot/, and then test the Isolinux.cfg file under the Isolinux folder in the installation disk into this directory and name it default

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/42/C0/wKioL1PYsnbzszxfAABxLxP39js459.jpg "title=" Create Pxelinux.img2.png "alt=" Wkiol1pysnbzszxfaabxlxp39js459.jpg "/>


3) Copy the boot kernel files in the installation disk into the TFTP file

The place where the files are placed in the TFTP service is within the/var/lib/tftpboot/, where we can copy the kernel files to the interface to download the hosts on the connection. The installation kernel files that PXE relies on are within pxeboot within the images folder within the installation disk.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/42/BA/wKiom1PYrEKC_3LaAAEmCOJt4Nc241.jpg "title=" Images.png "alt=" Wkiom1pyrekc_3laaaemcojt4nc241.jpg "/>

Copy these two files into the TFTP server. That's/var/lib/tftpboot/inside.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/42/BA/wKiom1PYrJ6AraW5AACf_QVgjaY902.jpg "title=" CP Inside the IMG within the source vmlinuz initrd.img5.png "alt=" Wkiom1pyrj6araw5aacf_qvgjay902.jpg "/>


4) Copy the installation background image and the installation selection box inside the installation disk into the TFTP file

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/42/BB/wKiom1PYrVLghUHuAAFR3_skIG0524.jpg "title=" Configure PEX files in 6.png "alt=" Wkiom1pyrvlghuhuaafr3_skig0524.jpg "/>


V: Create a ks.cfg file that enables automated installation


1) Install packages capable of configuring KS.CFG

Yum Install System-config-kiksstart

Open the Configuration Window command (with Xshellmanager package group)

System-config-kickstart

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/42/C0/wKiom1PYtHnDzPLLAAETKXybZZc054.jpg "title=" Ks.cfg1.png "alt=" Wkiom1pythndzpllaaetkxybzzc054.jpg "/>


Edit Pre-installation configuration file last saved to **.cfg This example is Ks.cfg

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/42/C0/wKiom1PYtW6goEYvAAI6tpKXWhM731.jpg "title=" Ks.cfg2.png "alt=" Wkiom1pytw6goeyvaai6tpkxwhm731.jpg "/>

The second method directly modifies the ***.cfg file generated in the previously installed program


650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/42/C0/wKioL1PYt3_SNEZSAADSM8eQvk4346.jpg "title=" Ks.cfg3.png "alt=" Wkiol1pyt3_snezsaadsm8eqvk4346.jpg "/>

VI: Create an installation source


1) This time we use the HTTP service as the source of the system installation

Install HTTP Service Yum install HTTP

Open HTTP Service httpd start


2) Create a CentOS folder under/var/www/html/

Mkdir/var/www/html/centos


3) Attach the source attached to the/media/cdrom to the/var/www/html/centos/

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

Seven: Configure the experiment host and client

This experiment uses C/s architecture

1) According to the above DHCP server we know this time the host IP address we set to 172.16.16.2. The IP address of the client host we obtained through the DHCP server.

2) Configure the Ks.cfg file

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/42/C2/wKioL1PYvwKj8Tn0AAFIUITWOjw932.jpg "title=" 11.png "alt=" Wkiol1pyvwkj8tn0aafiuitwojw932.jpg "/>

3) configuration/ver/lib/tftpboot/pxelinux.cfg/default

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/42/C1/wKiom1PYvMDSOTboAAD5o3UELkI792.jpg "title=" Default1.png "alt=" Wkiom1pyvmdsotboaad5o3uelki792.jpg "/>

Eight: Configure the virtual machine address of the experiment to install

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/42/C2/wKiom1PYvx2xmQ3gAAH1ChRVwWA386.jpg "title=" Virtual machine ip.png "alt=" Wkiom1pyvx2xmq3gaah1chrvwwa386.jpg "/>

Set boot options on boot

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/42/C2/wKiom1PYv-HTsH0dAAEn1aaISoY038.jpg "title=" Boot.png "alt=" Wkiom1pyv-htsh0daaen1aaisoy038.jpg "/>

Press ENTER after entering the boot interface

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/42/C2/wKiom1PYwEawpD7CAAK4eRxMRTU771.jpg "title=" Boot interface. png "alt=" wkiom1pyweawpd7caak4erxmrtu771.jpg "/>

Loading boot kernel files

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/42/C2/wKioL1PYwl3C58lhAAD8UqMgrTI171.jpg "title=" 1.png " alt= "Wkiol1pywl3c58lhaad8uqmgrti171.jpg"/>



to partition automatically

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/42/C2/wKiom1PYwYfyxQquAADbfIpUCaY067.jpg "title=" 2.png " alt= "Wkiom1pywyfyxqquaadbfipucay067.jpg"/>


Automatic installation of the line

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/42/C2/wKioL1PYwsiCMI8wAADp0BmCgmk385.jpg "title=" 3.png " alt= "Wkiol1pywsicmi8waadp0bmcgmk385.jpg"/>

End: PXE automated installation is over, and we can use the service configuration without having to install a single machine.

This article is from the "Slayer" blog, make sure to keep this source http://slayer.blog.51cto.com/4845839/1532937

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.