CentOS6 Pxe+kickstart Unattended Installation

Source: Internet
Author: User

First, Introduction 1.1 What is PXE

PXE (Pre-Boot execution Environment, pre-boot execution Environment) is the latest technology developed by Intel Corporation, working in the Client/server network mode, enabling workstations to download images from remote servers over the network, and thus support to boot the operating system through the network, during the boot process, the terminal requires the server to assign an IP address, and then use the TFTP protocol to download a boot package to the native memory execution, the boot package to complete the terminal basic software settings, thereby booting the terminal operating system pre-installed in the server. Strictly speaking, PXE is not a way to install, but a way to boot. A requirement for a PXE installation is that a PXE-supported network card (NIC) must be included on the computer to be installed, that is, the PXE Client must be in the network card. The PXE protocol enables a computer to boot over the network. This protocol is divided between the client side and the Server side, while the PXE client is in the ROM of the NIC. When the computer boots, the BIOS directs the PXE client into memory and then the files that are placed at the remote end by the PXE client are downloaded locally to run on the network. Running the PXE protocol requires setting up a DHCP server and a TFTP server. The DHCP server assigns an IP address to the PXE client (the host that will install the system), and because it assigns an IP address to the PXE client, the appropriate PXE settings need to be added when configuring the DHCP server. In addition, the TFTP client already exists in the PXE client ROM, so it can download the required files via the TFTP protocol to the TFTP Server.working process for PXE:1. PXE Client starts from its own PXE network card, requests IP from the DHCP server in the network, 2. The DHCP server returns the IP that is assigned to the client and the location of the PXE file (which is typically placed on a TFTP server); 3. The PXE Client requests the pxelinux.0 file from the TFTP server in the network, 4. The PXE Client obtains the pxelinux.0 file after it executes the file; 5. Load the kernel and file system via the TFTP server, based on the results of pxelinux.0 execution, 6. The installation screen can be installed by selecting one of the HTTP, FTP, NFS modes, and the detailed workflow is shown in the following picture:

1.2 What is Kickstart

Kickstart is an unattended installation method. It works by documenting typical parameters that require manual intervention during the installation process and generating a file named Ks.cfg. If you have to fill in the parameters during the installation process (not limited to the machine that generated the Kickstart installation files), the installer will first look for the files generated by the kickstart, and if the appropriate parameters are found, use the found parameters; Need to be manually intervened by the installer. So, if the kickstart file covers all the parameters that may be required during installation, then the installer can simply tell the installer where to fetch the ks.cfg file and then go to work on it. When the installation is complete, the installer restarts the system according to the settings in the Ks.cfg and ends the installation. Pxe+kickstart unattended installation of the operating system the complete process is as follows:

second, the system environment

Lab Environment: VMware Workstation System Platform: CentOS release 6.5 (minimized installation) Network mode: NAT mode (IP address of shared host) dhcp/tftp ip:192.168.111.130 Http/ftp/nfs ip:192.168.111.130 close iptables and SELinux

Iii. Preparatory work

The System-config-kickstart tool is required to generate the Ks.cfg file, and this tool relies on X windows, so we need to install X Windows and desktop and restart the system, as follows:

# yum Groupinstall "X window System" # yum Groupinstall desktop# yum groupinstall fonts# reboot
Iv. Configuring HTTP installation Methods 4.1 Install Configure HTTP, start the service and boot
# yum Install httpd–y#/etc/init.d/httpd start# chkconfig--level/httpd on
4.2 loading the ISO image

To set the load ISO image in the virtual machine:

Mount the ISO file to/mnt/cdrom:

4.3 Copy the entire contents of the disc to the root directory of HTTP/var/www/html/
# cp-r/mnt/cdrom//var/www/html/
v. Configuring TFTP 5.1 Installing Tftp-server
# yum Install Tftp-server–y
5.2 Enable TFTP service Tftp-server

# vi/etc/xinetd.d/tftp

Service TFTP {         Socket_type             = dgram         protocol                = UDP         Wait                    = yes         user                    = root         Server                  =/usr/sbin/in.tftpd         server_args             Disable                 = no per_source              = one         cps                     = 2         flags                   = IPv4}
5.3 Starting the TFTP service Tftp-server

Because the TFTP service is mounted under the hyper-process xinetd, start the xinetd to initiate the TFTP service and boot from the xinetd:

#/etc/init.d/xinetd restart# chkconfig xinetd on
vi. Configuring PXE-enabled boot programs 6.1 Copy the pxelinux.0 file to the/var/lib/tftpboot/folder
# Cp/usr/share/syslinux/pxelinux.0/var/lib/tftpboot

Description: Syslinux is a powerful boot loader and is compatible with a variety of media. More precisely: Syslinux is a small Linux operating system that is designed to simplify the first time you install Linux, and to create repair or other special-purpose boot disks.

6.2 Copy the/image/pxeboot/initrd.img and vmlinux in the ISO image to the/var/lib/tftpboot/folder
# Cp/var/www/html/cdrom/images/pxeboot/{initrd.img,vmlinuz}/var/lib/tftpboot/
6.3 Copy the ISO image in the/isolinux/*.msg to/var/lib/tftpboot/folder
# cp/var/www/html/cdrom/isolinux/*.msg/var/lib/tftpboot/
6.4 Create a new pxelinux.cfg directory in/var/lib/tftpboot/
# mkdir/var/lib/tftpboot/pxelinux.cfg
6.5 Copy the isolinux.cfg from the/isolinux directory in the ISO image to the Pxelinux.cfg directory, and change the file name to be called the default
# Cp/var/www/html/cdrom/isolinux/isolinux.cfg/var/lib/tftpboot/pxelinux.cfg/default
6.6 Modifying the default file

# Vi/var/lib/tftpboot/pxelinux.cfg/default

Default KS #默认启动的是 the boot kernel marked in ' label KS '
#显示 ' boot: ' Prompt. is not prompted for ' 0 ', the content specified in the ' default ' parameter will be started directly. 
#在用户输入之前的超时时间, the unit is 1/10 seconds. 
#显示某个文件的内容, note the path to the file. The default is under the/var/lib/tftpboot/directory. You can also refer to a path + file name similar to '/install/boot.msg '. 
#按下 ' F1 ' keys are displayed after the file. 
# ' label ' specifies the keywords you entered at the ' Boot: ' prompt, such as Boot:linux[enter], which will launch the ' label Linux ' tagged kernel and initrd.img files. 
the #kernel parameter specifies the kernel to start. 
#append Specify the parameters appended to the kernel, and the parameters appended to the kernel that can be used in grub are also available here. 
Label Text   kernel vmlinuz   append initrd=initrd.img text label ks   kernel vmlinuz   #告诉系统, Where to get the Ks.cfg file
Label Local   localboot 1 label memtest86   kernel memtest   Append-
Vii. Configuring DHCP 7.1 Installing the DHCP service
# yum-y Install DHCP
7.2 Copy the configuration template file into the DHCP configuration directory
# cp-f/usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample  /etc/dhcp/dhcpd.conf
7.3 Modify the/etc/dhcp/dhcpd.conf configuration file with the following contents:
Ddns-update-style Interim; Ignore client-updates;   FileName "pxelinux.0";  #pxelinux boot file location; Next-server 192.168.111.130; The IP address of the #TFTP Server; subnet 192.168.111.0 netmask 255.255.255.0 {        option routers                  192.168.111.130;         Option Subnet-mask              255.255.255.0;        Range DYNAMIC-BOOTP 192.168.111.100 192.168.111.200;         Default-lease-time 21600;         Max-lease-time 43200;}
7.4 Starting the DHCP service
#/ETC/INIT.D/DHCPD Start
Viii. generating ks.cfg files 8.1 Installing Kickstart
# yum Install System-config-kickstart

Start the X Windows environment

# STARTX

Configure Kickstart

# System-config-kickstart

A. Set language, keyboard, time zone, root password, reboot after installation.

B. Set the installation method, this article describes the installation of HTTP mode, so select the HTTP

C. Installing the MBR

D. Setting Up partitions

E. Overview of partitions

F. Configuring the Network

G. Authentication configuration

h. SELinux and firewall configuration

I. Graphical Environment configuration

J. Package Installation Options

K. Preview

L. Generate the Ks.cfg file, save it in the/var/www/html/folder

Nine, test installation

1. Create a virtual machine 2. Start the virtual machine, select start from the network card, and the DHCP server is assigning an IP address to the client.

3. Start downloading Vmlinuz and initrd.img

4. Installation process ...

Free to provide the latest Linux technology tutorials Books, for open-source technology enthusiasts to do more and better: http://www.linuxprobe.com/

CentOS6 Pxe+kickstart Unattended Installation

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.