Configure pxe to automatically install centos6.7 and pxecentos6.7

Source: Internet
Author: User

Configure pxe to automatically install centos6.7 and pxecentos6.7

Dhcp server is a required condition for automatic installation of pxe. Therefore, you must first set the dhcp server, yum-y install dhcp, and rpm-ql dhcp to check which packages are installed. less/etc/dhcp/dhcpd. conf open the main configuration file of dhcp, such:

 

No configuration, but prompts where to find the Master configuration file, cp/usr/share/doc/dhcp-4.1.1/dhcpd. conf. sample/etc/dhcp. conf overwrites the main configuration file, vim/etc/dhcp/dhcpd. if conf is enabled again, the default-lease-time 600; (default lease duration) parameter is set to 600 seconds. To avoid interference with other parameters, move the cursor to 29 rows and then execute :., $ s @ ^ [^ #] @ # & @ command (add a non-blank line starting with non-# To the beginning of the current line #), next, define the CIDR block to be allocated in subnet, as shown in:

 

Save and exit! Service dhcpd start service ss-unl check whether server port 67 is listening.

Set the network adapter address to 172.16.0.199/16 as the default gateway of the client.

Start another client and run the dhclient-d command to view how to obtain the address.

In this way, a dhcp server is started and a 172.16.100.29 address is assigned to the client.

But sometimes we need to assign a fixed address to a client, vim/etc/dhcp/dhcpd. conf

To add a configuration, you only need to write the physical NIC address of the client.

See the figure below:

The filename parameter and the next-server parameter are added. filename indicates to tell the client to load the pxelinux.0 file after obtaining the address, where to load the file, and the address specified in next-server, here is 172.16.100.13. Pxelinux.0 is the name of the initial boot file to be loaded during Nic boot. The file specified at filename must be placed on the tftp-server.

 

The second requirement is to start a virtual machine and handle tftp-server, yum-y install tftp-server, and yum-y install syslinux.

Syslinux is a bunch of boot loaders, which are used in pxe network boot. The pxelinux.0 file is available in the/usr/share/syslinux/directory.

The tftp-server is managed by the super daemon xinetd. Therefore, vim/etc/xinetd. d/tftp changes disable = yes to no and service xinetd restart. Ss-unl: Check whether port 69 has been listened on.

The default file storage path of the tftp server is/var/lib/tftpboot. Cp/usr/share/syslinux/pxelinux.0/var/lib/tftpboot/

Put the attached disc into the CD. mkdir/media/cdrom mount-r/dev/cdrom/media/cdrom also needs to create a yum warehouse and place the file in the CD. I will put it on httpd. Install httpd server, yum-y installl httpd, mkdir/var/www/html/centos6 create directory hard link mount -- bind/media/cdrom/var/www/html/centos6 ls/var/www/html/centos6

Create a kickstart file to customize how to install the system. yum-y install system-config-kickstart, system-config-kickstart

 

 

 

 

 

 

You do not need to configure the following items for convenience. You can use the ksvalidator command to check whether there is a syntax error ksvalidator centos6.cfg. Cp/root/centos6.cfg/var/www/html/

Service httpd start

Next, copy several necessary files: cp/media/cdrom/images/pxeboot/{vmlinuz, initrd. img}/var/lib/tftpboot/

Cp/media/cdrom/isolinux/{boot.msg, splash.jpg, vesamenu. c32}/var/lib/tftpboot/

Mkdir/var/lib/tftpboot/pxelinux. cfg cp/media/cdrom/isolinux. cfg/var/lib/tftpboot/pxelinux. cfg/default

Ls/var/lib/tftpboot

 

Vim/var/lib/tftpboot/pxelinux. cfg/default

 

Add ks = http: // 172.16.100.10/centos6.cfg

Start a VM to boot from the NIC:

 

Change the number of graphic lines under # Use graphic install in the centos6.cfg file to # Use text install text. You do not need to click next for guidance:

All done !!!

 

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.