KICKSTART+PXE unattended installation of Linux

Source: Internet
Author: User

1, Kickstart and PXE introduction:

Kickstart is an unattended installation mode introduced by Red Hat, which enables the automatic installation of large batches of clients. In general, when we install the Linux operating system, we use an interactive response interface mode to determine how our system should be installed, such as the language that the installation process displays, the type of keyboard used, the time zone information, the package to be preinstalled, the disk partition information, and so on. The function that kickstart completes is to pre-write all the questions that must be answered into a configuration table called Ks.cfg, and then boot the process to find the configuration table to automatically boot the remaining installation work and answer for automated installation.

PXE is a pre-boot execution Environment technology developed by Intel Corporation, Combined with kickstart, the client can automatically obtain the Ks.cfg files located on the network, boot the installation files and so on, so that the user can install the operating system automatically and easily without additional configuration, and can complete the large-scale client installation.


2, the implementation process of KICKSTART+PXE:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/70/77/wKioL1W4eFvxWQt8AAG1Lzz8_f8925.jpg "title=" 1.png " alt= "Wkiol1w4efvxwqt8aag1lzz8_f8925.jpg"/>


3. Experimental environment:

VMware Workstations + centos6.5-i386

DHCP server address: 192.168.47.100

TFTPFFF Server address: 192.168.47.100

FTP Server address: 192.168.47.100

Installation Tree directory:/var/ftp/pub

Bootstrapper directory:/var/lib/tftpboot

Ks.cfg Location:/var/ftp/


4: Experimental Steps:

1), install the DHCP server, and configure the relevant information:

[email protected] ~]# yum install dhcp-yloaded plugins:fastestmirrorloading mirror speeds from cached Hostfile * c6-med Ia:setting up Install processresolving dependencies--> Running Transaction Check ... (process slightly) Installed:dhcp.i686 12:4.1.1-38.p1.el6.centos Dependency Installed:portreser ve.i686 0:0.0.4-9.el6

Open the main configuration file for DHCP (/etc/dhcp/dhcpd.conf) and make the following changes:

Because the new DHCP service Master profile has no content, import the system template file in the bottom-line mode:


650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/70/78/wKioL1W4evexTggWAAFvf3Vhhd8834.jpg "title=" 2.png " alt= "Wkiol1w4evextggwaafvf3vhhd8834.jpg"/>

Keep the following configuration:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/70/7C/wKiom1W4fKOTzzNgAAIBtns2ELg260.jpg "title=" 4.png " alt= "Wkiom1w4fkotzzngaaibtns2elg260.jpg"/>

Start the DHCP server:

[[Email protected] ~]# service DHCPD startstarting dhcpd: [OK]

2), install the FTP server:

[[email protected] ~]# yum install vsftpd  tftp-server -yloaded plugins: fastestmirrorloading mirror speeds from  Cached hostfile * c6-media: setting up install process ... (Process slightly) installed:  tftp-server.i686 0:0.49-7.el6                                               dependency installed:  xinetd.i686 2:2.3.14-39.el6_4                                               complete! 

Because TFTP is dependent on the XINETD process, the configuration file is under/etc/xinetd.d/tftp:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/70/79/wKioL1W4f9GC9QZGAAEA29AwLzA688.jpg "title=" 5.png " alt= "Wkiol1w4f9gc9qzgaaea29awlza688.jpg"/>

To start the TFTP server:

[[Email protected] ~]# service xinetd startstarting xinetd: [OK]

Port 69 has been started:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/70/7C/wKiom1W4fo3zATOcAAB1ol45ocs413.jpg "title=" 6.png " alt= "Wkiom1w4fo3zatocaab1ol45ocs413.jpg"/>


3), Import boot content:

Locate the TFTP server's home directory/var/lib/tftpboot/, import the kernel and driver files from the Isolinux directory on the CD

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/70/79/wKioL1W4gajjEOLIAAGn_Re12sM588.jpg "title=" 7.png " alt= "Wkiol1w4gajjeoliaagn_re12sm588.jpg"/>


Install the Syslinux software package on the CD and get the network boot file pxelinux.0

[[email protected] tftpboot]# yum install syslinux -yloaded plugins:  fastestmirrorloading mirror speeds from cached hostfile * c6-media:  setting up install processresolving dependencies--> running transaction  Check ... (Process slightly) installed:  syslinux.i686 0:4.02-8.el6                                                  Dependency Installed:  mtools.i686 0:4.0.12-1.el6                                                  complete! 

Locate pxelinux.0 this file (), copy to the root of the TFTP server

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/70/79/wKioL1W4gu_BdnssAAFxYE3f8b8394.jpg "title=" 8.png " alt= "Wkiol1w4gu_bdnssaafxye3f8b8394.jpg"/>

Create the directory pxelinux.cfg directory, copy the network boot program on the CD and rename it to default:

[Email protected] tftpboot]# mkdir pxelinux.cfg[[email protected] tftpboot]# cp/media/cdrom/isolinux/isolinux.cfg Pxelinux.cfg/default[[email protected] tftpboot]# lltotal 34944-r--r--r--. 1 root root 31742048 Jul 23:26 initrd.img-rw-r--r--. 1 root root 26828 Jul 23:31 pxelinux.0drwxr-xr-x. 2 root root 4096 Jul 23:34 pxelinux.cfg-r-xr-xr-x. 1 root root 4002656 Jul 23:26 vmlinuz

Modify the contents of the bootstrapper

default linux     #将默认的引导菜单修改为第一个linux菜单 #prompt 1timeout 60          #修改引导等待时间为60秒display  boot.msgmenu background splash.jpgmenu  title Welcome to CentOS 6.5!menu color border 0  #ffffffff  # 00000000menu color sel 7  #ffffffff   #ff000000menu  color title 0 # ffffffff  #00000000menu  color tabmsg 0  #ffffffff   #00000000menu  color  unsel 0  #ffffffff   #00000000menu  color hotsel 0  #ff000000   #ffffffffmenu  color hotkey 7  #ffffffff   #ff000000menu  color scrollbar 0 # ffffffff  #00000000label  linux  menu label ^install or upgrade an  existing system  menu default  kernel vmlinuz  append  Initrd=initrd.img  ks=ftp://192.168.47.100/ks.cfg     #指定ks the location of the. cfg file, be careful not to break the line, or you will not find the Ks.cfg file    ......


4), install System-config-kickstart, generate automated installation files Ks.cfg:

[email protected] pxelinux.cfg]# Yum install system-config-kickstart-y ... (Process slightly)

Generate the Ks.cfg file:

[Email protected] var]# system-config-kickstartxlib:extension "RANDR" missing on display "localhost:12.0"./usr/share/ System-config-kickstart/kickstartgui.py:103:gtkwarning:gtkspinbutton:setting An adjustment with Non-zero page size is Deprecated XML = Gtk.glade.XML ("/usr/share/system-config-kickstart/system-config-kickstart.glade", domain= "  System-config-kickstart ") Loaded plugins:fastestmirrorloading mirror speeds from cached hostfile * c6-media:checking for New Repos for Mirrors

Note: A dialog will pop up, click on the bottom left of the third option, if you cannot find the package can be installed, please reconfigure the local Yum Source:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/70/7D/wKiom1W4hYDT-ZlOAAJYwIe_LMM491.jpg "title=" 9.jpg " alt= "Wkiom1w4hydt-zloaajywie_lmm491.jpg"/>

Basic configuration:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/70/7A/wKioL1W4iTrhaTf_AAMhbg_3YRo806.jpg "title=" 10.png "alt=" Wkiol1w4itrhatf_aamhbg_3yro806.jpg "/>

Installation method:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/70/7D/wKiom1W4iH2APzNzAAHjOU_bluE703.jpg "title=" 11.jpg "alt=" Wkiom1w4ih2apznzaahjou_blue703.jpg "/>

Boot Record settings:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/70/7A/wKioL1W4i3qjuA61AAHMNBJBlpY867.jpg "title=" 12.png "alt=" Wkiol1w4i3qjua61aahmnbjblpy867.jpg "/>

Partition settings:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/70/7A/wKioL1W4jUmzYpLiAAJJ_6hBJyM039.jpg "title=" 13.png "alt=" Wkiol1w4jumzypliaajj_6hbjym039.jpg "/>

Network settings:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/70/7D/wKiom1W4i-uxlMjnAAFCpLJi5Qw537.jpg "title=" 14.png "alt=" Wkiom1w4i-uxlmjnaafcplji5qw537.jpg "/>

Network Security settings:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/70/7A/wKioL1W4j0DhsXSOAAEPRmt2FZA564.jpg "style=" float: none; "title=" 15.png "alt=" Wkiol1w4j0dhsxsoaaeprmt2fza564.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/70/7D/wKiom1W4jVGgH90FAAEIKlhx0gc416.jpg "style=" float: none; "title=" 16.png "alt=" Wkiom1w4jvggh90faaeiklhx0gc416.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/70/7A/wKioL1W4j0CRk7sUAAEPRNOeOQ0490.jpg "style=" float: none; "title=" 17.png "alt=" Wkiol1w4j0crk7suaaeprnoeoq0490.jpg "/>


Pre-install package selection (on-demand selection):

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/70/7A/wKioL1W4j3KTZ6t-AAJIQ6VIgLk927.jpg "title=" 18.png "alt=" Wkiol1w4j3ktz6t-aajiq6viglk927.jpg "/>

Run the script after installation (the main feature is to pin the NIC content host name):

#!/bin/bashstring= ' ifconfig eth0 |grep ' inet\> ' |awk ' {print $} ' num=${string##*.} Sed-i-E "[email protected]*@[email protected]"/etc/sysconfig/networkecho "Device=eth0\nonboot=yes\nbootproto=stat ic\nipaddr=192.168.47. $num \nnetmask=255.255.255.0\ngateway=192.168.47.254\n ">/etc/sysconfig/network-scripts /ifcfg-eth0

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/70/7A/wKioL1W4kxWwT0qTAAHVSoGtJTo500.jpg "title=" 19.png "alt=" Wkiol1w4kxwwt0qtaahvsogtjto500.jpg "/>

Generate the Ks.cfg file and place it in the/root directory

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/70/7B/wKioL1W4k2fzQ1JhAADy1ck5O6A785.jpg "title=" 20.png "alt=" Wkiol1w4k2fzq1jhaady1ck5o6a785.jpg "/>


Add a Poweroff to the Ks.cfg file, indicating that the system is set to off after installation is complete


4), set up the FTP server:

Copy the contents of the CD to the FTP server (/var/ftp/pub)

[Email protected] ~]# cp-r/media/cdrom/*/var/ftp/pub

Copy the modified Ks.cfg file to the root directory of the FTP server (/var/ftp/)

[Email protected] ~]# cp/root/ks.cfg/var/ftp/[[email protected] ~]# ll/var/ftptotal 8-rw-r--r--. 1 root root 1403 Jul 00:48 ks.cfgdrwxr-xr-x. 6 root root 4096 Jul 23:43 pub

To start the FTP service:

[[Email protected] ~]# service vsftpd startstarting vsftpd for vsftpd: [OK]


5), Installation test:

Create a new virtual machine and set the hardware properties where the NIC is aware of the consistency with the server:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/70/7B/wKioL1W4lkGQBIb-AAGn7RoJAes901.jpg "title=" 21.png "alt=" Wkiol1w4lkgqbib-aagn7rojaes901.jpg "/>

Click on the option bar of the virtual machine-"Power---" to enter the BIOS when it starts, and then start the virtual machine

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/70/7E/wKiom1W4lPKRG6BYAAFaagqJZRo947.jpg "title=" 22.png "alt=" Wkiom1w4lpkrg6byaafaagqjzro947.jpg "/>


After entering the BIOS, select boot sequence, move the network boot to the top, and press F10 to save the exit:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/70/7E/wKiom1W4lWqQtEoEAAEZEk0xZ6E461.jpg "title=" 23.png "alt=" Wkiom1w4lwqqteoeaaezek0xz6e461.jpg "/>


To obtain a dynamic address to the DHCP server via the MAC address:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/70/7B/wKioL1W4mduwafFlAADYepX4O18630.jpg "title=" 24.png "alt=" Wkiol1w4mduwafflaadyepx4o18630.jpg "/>


Locate the FTP server and download the Ks.cfg file:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/70/7B/wKioL1W4mf6wBgBEAABpsUFzQQ4793.jpg "title=" 25.png "alt=" Wkiol1w4mf6wbgbeaabpsufzqq4793.jpg "/>


Start automating the installation of the operating system:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/70/7E/wKiom1W4mCqT9d1cAADidqTgoqE370.jpg "title=" 26.png "alt=" Wkiom1w4mcqt9d1caadidqtgoqe370.jpg "/>


Due to the setting, the system will be shut down automatically after installation, reboot the system, enter to view hostname and network card information:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/70/7F/wKiom1W4mdbg17tFAACZsIbq770768.jpg "title=" A.png " alt= "Wkiom1w4mdbg17tfaaczsibq770768.jpg"/>


5. Summary

Before you do the experiment, be sure to understand the kickstart and PXE work processes, and what services are needed to support and guide the software and files. Only in this way can we build an unattended installation service correctly and quickly.

This article is from the "but evil Water Heart Pan" blog, please be sure to keep this source http://shmilyfl.blog.51cto.com/8897986/1679721

KICKSTART+PXE unattended installation of Linux

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.