Pxe+dhcp+tftp+kickstart Batch installation of CentOS detailed

Source: Internet
Author: User
Tags file url

First, the scene introduction

When we want to deploy a large number of servers, the traditional CD-ROM or USB stick installation system is no longer suitable, in order to deal with this scenario, PXE with kickstart unattended installation is a good way.

1. What is PXE

PXE is a boot program, divided into client side and server side, first, the server to be automated installation must have a PXE-capable network card, that is, the network card ROM must have a PXE client. When the computer boots, the BIOS takes the PXE client and the TFTP client into memory (TFTP client is also built into the NIC Rom) and downloads the remote files to the local network to run locally. So PEX-guided execution also requires a DHCP service that can provide addresses to the server and the tftpserver of the files that are stored.

2. What's the matter Kickstart

Kickstart is an unattended installation method. He is the installation process requires human interaction input of various parameters saved in a ks.cfg file, the installation process encountered when the need to fill in the parameters will automatically find the file to get parameters, if not found, will stop in the current interface waiting for manual input.

3. Installation process

Plan to deploy 2 servers to complete an unattended installation with the topology map:

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= "http ://s2.51cto.com/wyfs02/m00/85/53/wkiom1eggzbshv5kaab-dc0pbms142.png-wh_500x0-wm_3-wmp_4-s_1881203305.png "title = "1.png" style= "Float:none;" alt= "Wkiom1eggzbshv5kaab-dc0pbms142.png-wh_50"/>

The unattended installation process is:

(l) When the ient end is started, it will broadcast the request address in the intranet.

(2) When the DHCP server receives the request, it assigns an IP address to the client side and also tells the client the address of the TFTP server

(3) The client obtains the boot file from the TFTP server, and the address of the boot file containing the auto answer file Ks.cfg points to

(4) The client is installed according to the parameter setting and installation tree location in the auto answer file

Second, pre-installation preparation

1. Modify the IP address of each server as planned

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= "http ://s4.51cto.com/wyfs02/m00/85/52/wkiol1eggzaj0np2aaau4vkkj5s177.png-wh_500x0-wm_3-wmp_4-s_2874137504.png "title = "2.png" style= "Float:none;" alt= "Wkiol1eggzaj0np2aaau4vkkj5s177.png-wh_50"/>

2. Disable SELinux on the server, the modification does not take effect immediately, it is recommended to restart the operating system

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= "http ://s4.51cto.com/wyfs02/m00/85/52/wkiol1eggzat_0zaaabkswobylq341.png-wh_500x0-wm_3-wmp_4-s_1416499349.png "title = "3.png" style= "Float:none;" alt= "Wkiol1eggzat_0zaaabkswobylq341.png-wh_50"/>

3. shut down the firewall , service iptables stop otherwise the client will error, close! Shut down! Shut down!

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= "http ://s4.51cto.com/wyfs02/m01/85/53/wkiom1eggzfgrlgjaaaduq7rcdo315.png-wh_500x0-wm_3-wmp_4-s_11267372.png "title=" 4.png "style=" Float:none; "alt=" Wkiom1eggzfgrlgjaaaduq7rcdo315.png-wh_50 "/>

4. Insert the disc and hang it in the/media directory

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= "http ://s4.51cto.com/wyfs02/m01/85/53/wkiom1eggzfxewi4aaatgobveyg743.png-wh_500x0-wm_3-wmp_4-s_3375092424.png "title = "5.png" style= "Float:none;" alt= "Wkiom1eggzfxewi4aaatgobveyg743.png-wh_50"/>

5. Use Rm-f $ (ls. | grep-v ' Me ') to delete the other Yum sources in the/etc/yum.repo.d/directory, leaving only the Centos-media source and modifying the location of the URL. Why delete other Yum sources, since the specified cost is 100, it will still look for other Yum sources instead of media, to reduce interference, or to change the enable of other Yum sources to 0 .

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= "http ://s4.51cto.com/wyfs02/m01/85/52/wkiol1eggzfdblexaaaehtya01y139.png-wh_500x0-wm_3-wmp_4-s_3648087280.png "title = "6.png" style= "Float:none;" alt= "Wkiol1eggzfdblexaaaehtya01y139.png-wh_50"/>

Third, installation steps

1. Install the DHCP server

(1) Installing DHCP service using YUM-Y install DHCP

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= "http ://s4.51cto.com/wyfs02/m02/85/53/wkiom1eggzebshtqaaacyusawru865.png-wh_500x0-wm_3-wmp_4-s_288868703.png "title= "7.png" style= "Float:none;" alt= "Wkiom1eggzebshtqaaacyusawru865.png-wh_50"/>

(2) Edit the/etc/dhcp/dhcpd.conf file, or you can copy a template, on the basis of the template modification, the command is:

cp/usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/dhcp/dhcpd.conf. What you need to explain here is: is the address of the TFTP server; filename

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= "http ://s3.51cto.com/wyfs02/m02/85/52/wkiol1eggzia0dz2aabox80nqba286.png-wh_500x0-wm_3-wmp_4-s_1354313512.png "title = "8.png" style= "Float:none;" alt= "Wkiol1eggzia0dz2aabox80nqba286.png-wh_50"/>

(3) Specify the network port in/ETC/SYSCONFIG/DHCPD that provides the DHCP service, here is eth0

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= "http ://s3.51cto.com/wyfs02/m00/85/53/wkiom1eggzigecejaaazjwlwxng263.png-wh_500x0-wm_3-wmp_4-s_1892112191.png "title = "9.png" style= "Float:none;" alt= "Wkiom1eggzigecejaaazjwlwxng263.png-wh_50"/>

(4) Start the DHCP service and set turn on auto start

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= "http ://s3.51cto.com/wyfs02/m00/85/52/wkiol1eggzijipzdaaay3ldm_ym930.png-wh_500x0-wm_3-wmp_4-s_416970837.png "title= "10.png" style= "Float:none;" alt= "Wkiol1eggzijipzdaaay3ldm_ym930.png-wh_50"/>

(5) DHCP uses the UDP protocol by default to check if the port is listening properly

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= "http ://s3.51cto.com/wyfs02/m01/85/53/wkiom1eggznd1s1vaaa_gvunq38407.png-wh_500x0-wm_3-wmp_4-s_1845161075.png "title = "11.png" style= "Float:none;" alt= "Wkiom1eggznd1s1vaaa_gvunq38407.png-wh_50"/>

2. Installing the TFTP server

(1) Installing the TFTP server using the Yum- y install Tftp-server

(2) Use chkconfig tftp on; Chkconfig xinetd on to open TFTP and xinetd service, from Chkconfig--list can see TFTP and xinetd service is turned on. What to note here is:What is the xinetd service ? We know that service is a memory-resident process that consumes certain system resources, and that some services may occasionally be used, so it is a waste to keep open to memory resources, which is managed uniformly by xinetd services, and when this service is needed, xinetd wakes up the corresponding service. This only needs to start a xinetd service, saving memory resources

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= "http ://s5.51cto.com/wyfs02/m01/85/52/wkiol1eggznqzod2aablsxpisyc170.png-wh_500x0-wm_3-wmp_4-s_2723032657.png "title = "12.png" style= "Float:none;" alt= "Wkiol1eggznqzod2aablsxpisyc170.png-wh_50"/>

Another point to note is that the TFTP root directory is/var/lib/tftpboot from the TFTP configuration file, so the filename "/pxelinux.0" file in the Install DHCP server step (2) should be placed in the /var/ in the Lib/tftpboot directory

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= "http ://s5.51cto.com/wyfs02/m01/85/52/wkiol1eggzns85bcaabgqqqvfca251.png-wh_500x0-wm_3-wmp_4-s_3822003317.png "title = "13.png" style= "Float:none;" alt= "Wkiol1eggzns85bcaabgqqqvfca251.png-wh_50"/>

(4) Check if the port number 69th used by TFTP is listening properly

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= "http ://s3.51cto.com/wyfs02/m02/85/53/wkiom1eggzqzck9-aaa-goqrbyw356.png-wh_500x0-wm_3-wmp_4-s_1478695782.png "title = "14.png" style= "Float:none;" alt= "Wkiom1eggzqzck9-aaa-goqrbyw356.png-wh_50"/>

3. Install the HTTP service

(1) Install httpd service using yum-y inistall httpd

(2) Use service httpd start && chkconfig httpd on to start the httpd service and set up boot

(3) Create a CENTOS6 directory, the CD-ROM from the re-mount to the directory, regardless of how to do, as long as the installation CD content can be used by the client through the Web Access, its role is to provide the installation tree in the Ks.cfg file URL pointing, can be HTTP or NFS, etc.

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= "http ://s3.51cto.com/wyfs02/m02/85/53/wkiom1eggzrzlosuaaa1c9r8mb8679.png-wh_500x0-wm_3-wmp_4-s_1761997127.png "title = "15.png" style= "Float:none;" alt= "Wkiom1eggzrzlosuaaa1c9r8mb8679.png-wh_50"/>

(4) Check whether the 80 port of the HTPPD server is listening properly and the service is normal.

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= "http ://s3.51cto.com/wyfs02/m02/85/53/wkiol1eggzvhn_f-aabgcsm0pxq510.png-wh_500x0-wm_3-wmp_4-s_1055918800.png "title = "16.png" style= "Float:none;" alt= "Wkiol1eggzvhn_f-aabgcsm0pxq510.png-wh_50"/>

4.PXE Configuration Boot

(1) The pxelinux.0 file mentioned earlier is in the Syslinux boot program, so install the Syslinux program first, Yum-y installed Syslinux

(2) Copy the Vmlinuz and initrd.img files in the/var/www/html/centos6/images/pxeboot/directory;/var/www/html/centos6/ Boot.msg, VESAMENU.C32, splash.jpg files in the isolinux/directory are copied to the TFTP server root record/var/lib/tftpboot/, Because the pxelinux.0 file replaces the Isolinux.bin, you do not have to copy

(3) Copy the pxelinux.0 file to the root of the FTFP server record cp/usr/share/syslinux/pxelinux.0/var/lib/tftpboot/

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= "http ://s3.51cto.com/wyfs02/m02/85/53/wkiol1eggzvzzjocaaa24xuxsvc067.png-wh_500x0-wm_3-wmp_4-s_3105534398.png "title = "17.png" style= "Float:none;" alt= "Wkiol1eggzvzzjocaaa24xuxsvc067.png-wh_50"/>

(4) similar to Isolinux.cfg to provide configuration files to Isolinux.bin, we also need to provide a configuration file for pxelinux.0, and the configuration file needs to be placed in the /var/lib/tftpboot/pxelinux.cfg in this special directory,

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= "http ://s3.51cto.com/wyfs02/m00/85/53/wkiom1eggzugqm5saaaspqbvemm836.png-wh_500x0-wm_3-wmp_4-s_1004143515.png "title = "18.png" style= "Float:none;" alt= "Wkiom1eggzugqm5saaaspqbvemm836.png-wh_50"/>

(5) Isolinux.cfg file when template, copy to /var/lib/tftpboot/pxelinux.cfg/default needs to be renamed to default. The boot environment is now complete

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= "http ://s3.51cto.com/wyfs02/m00/85/53/wkiom1eggzzj_1rpaaaumqqyegm460.png-wh_500x0-wm_3-wmp_4-s_3256565682.png "title = "19.png" style= "Float:none;" alt= "Wkiom1eggzzj_1rpaaaumqqyegm460.png-wh_50"/>

5. The first Test, create a new server to select the network card to start, see the client after acquiring the IP can enter the installation interface, indicating that you can normally obtain the boot file on the TFTP, need to explain at this time he will also automatically obtain an IP address, The reason is that this is no longer the TFTP phase but the anaconda phase, so you need to get the address again and see it in his profile anaconda.cfg.

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= "http ://s5.51cto.com/wyfs02/m00/85/53/wkiol1eggzybc4qvaaa5rk9-v8y873.png-wh_500x0-wm_3-wmp_4-s_2800774920.png "title = "20.png" style= "Float:none;" alt= "Wkiol1eggzybc4qvaaa5rk9-v8y873.png-wh_50"/>

6. Configuring the Ks.cfg File

(1) KS files can be generated by System-config-kiskstart, the recommended use of existing KS files when the template, in the administrator's home directory has a anaconda-ks.cfg file, you can use it as a template

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= "http ://s5.51cto.com/wyfs02/m00/85/53/wkiol1eggzzz89n9aaaihzvttjm217.png-wh_500x0-wm_3-wmp_4-s_3485365249.png "title = "21.png" style= "Float:none;" alt= "Wkiol1eggzzz89n9aaaihzvttjm217.png-wh_50"/>

(2) Copy the Anaconda.cfg file to the/var/www/html directory renamed to Ks.cfg, note that the Read permission for this file is only available to the administrator, and the automatic installation of this file is initiated by Apache, So the matching is Apache user rights, which makes it impossible to access

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= "http ://s2.51cto.com/wyfs02/m01/85/53/wkiom1eggz2tqgu1aaavdm7rg0q178.png-wh_500x0-wm_3-wmp_4-s_1168240542.png "title = "22.png" style= "Float:none;" alt= "Wkiom1eggz2tqgu1aaavdm7rg0q178.png-wh_50"/>

(3) Modify Ks.cfg file permissions to allow other users to have Read permissions

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= "http ://s2.51cto.com/wyfs02/m01/85/53/wkiol1eggz3ahzk6aaaldddhk18925.png-wh_500x0-wm_3-wmp_4-s_2149788599.png "title = "23.png" style= "Float:none;" alt= "Wkiol1eggz3ahzk6aaaldddhk18925.png-wh_50"/>

(4) Modify the Ks.cfg file, change the installation mode to a URL and specify the installation tree location and repo location, and set the disk partition, the administrator password can be encrypted using Grub-crypt method to paste the string here

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= "http ://s2.51cto.com/wyfs02/m01/85/53/wkiom1eggz3jhpfsaacjgsfecrq487.png-wh_500x0-wm_3-wmp_4-s_1567354816.png "title = "24.png" style= "Float:none;" alt= "Wkiom1eggz3jhpfsaacjgsfecrq487.png-wh_50"/>

(5) return to the TFTP server to indicate the path of the KS file within the PXE configuration file /var/lib/tftpboot/pxelinux.cfg/default, if any Multiple network cards also need to indicate the use of KS installed network card , not specified by the installation will let you specify manually, will not achieve the purpose of automated installation

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= "http ://s2.51cto.com/wyfs02/m01/85/53/wkiol1eggz6dd-aeaaahly7repq927.png-wh_500x0-wm_3-wmp_4-s_2533340473.png "title = "25.png" style= "Float:none;" alt= "Wkiol1eggz6dd-aeaaahly7repq927.png-wh_50"/>

(6) test again, can be successfully installed automatically, at this point, all operations completed

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= "http ://s3.51cto.com/wyfs02/m02/85/53/wkiom1eggz6cqxpuaaaqcdrudvq535.png-wh_500x0-wm_3-wmp_4-s_3777492530.png "title = "26.png" style= "Float:none;" alt= "Wkiom1eggz6cqxpuaaaqcdrudvq535.png-wh_50"/>



This article from "Rabbit-like rabbit sen Broken" blog, please be sure to keep this source http://arkling.blog.51cto.com/2844506/1833444

Pxe+dhcp+tftp+kickstart Batch installation of CentOS detailed

Related Article

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.