PXE Batch automated installation system

Source: Internet
Author: User

I've seen a lot of people. Using PXE unattended documents, writing is always missing something, through their own use and combined with the documentation of the operations staff, write a relatively basic PXE deployment, suitable for beginners to use the first.

Experimental environment: cnetos6.6 ip:

1. Installing the Software

[[Email protected]~]# yum-y Install DHCP tftp-server httpd syslinux


[[Email protected]~]# cp-rf/usr/share/doc/dhcp*/dhcpd.conf.sample/etc/dhcp/dhcpd.conf
CP: Do you want to overwrite "/etc/dhcp/dhcpd.conf"? Y
[[Email protected]~]# vim/etc/dhcp/dhcpd.conf
Add the following:

Ddns-update-style Interim; #设置DHCP服务器模式

Ignore client-updates; #禁止客户端更新

Allow booting; #定义能够PXE启动

Allow BOOTP; #定义支持bootp

Subnet netmask { #设置网段

option routers;

Option Subnet-mask; #设置掩码子网

Range DYNAMIC-BOOTP; #设置dhcp服务器IP地址租用的范围, DYNAMIC-BOOTP on behalf of the DHCP server to support PXE

Default-lease-time 64600; #默认租约时间

Max-lease-time 43200; #最大租约时间

Next-server; #tftp服务器地址

FileName "pxelinux.0"; #最基本的启动文件. Pointing to the root directory of the Tftp-sever


[[Email protected]~]# service DHCPD restart
[[Email protected]~]# chkconfig DHCPD on

(1). pxelinux.0
[[email protected] ~]# Find/-name pxelinux.0
[[email protected]~]# cp/usr/share/syslinux/ pxelinux.0/var/lib/tftpboot/

(2). Provide the required files for the boot menu (from the Isolinux directory on the system CD)
[[Email protected]~]# cp-rf/media/centos_6.6_final/isolinux/*/var/lib/tftpboot/(/media/centos_6.6_final is the system CD mount point)
[[Email protected]~]# mkdir/var/lib/tftpboot/pxelinux.cfg
Copy Isolinux.cfg to pxelinux.cfg and rename to default:
[[Email protected]~]# cd/var/lib/tftpboot/
[email protected] tftpboot]# CP isolinux.cfg Pxelinux.cfg/default

(3). Edit the Start menu
[Email protected]~]# vim Pxelinux.cfg/default

Default Vesamenu.c32

#prompt 1

Timeout #系统选择安装时的时间, default is 600 (60 seconds), in order to reduce the waiting time to 2 seconds


Label Linux

Menu label ^install or upgrade an existing system

Menu default

Kernel Vmlinuz

Append initrd=initrd.img ks= #指定ks的路径, native address


(4). Modify the Tftp-server configuration file
[[Email protected]~]# vim/etc/xinetd.d/tftp


Disable = no #yes改为no


[[Email protected]~]# service xinetd Restart
[[Email protected]~]# netstat-an|grep:69
The following information appears to indicate that it has started:

UDP 0 0*

4. by ftp| httpd| NFS provides installation tree (for example, httpd)
Create a directory in the root of HTTP to mount the system image file
[[email protected]~]# mkdir/ var/www/html/centos6.6
[[email protected]~]# mount/dev/cdrom/var/www/html/centos6.6
[[email  protected]~]# service httpd Restart
[[email protected]~]# chkoconfig httpd on

5. Automatic installation via Kickstart
The entire installation process to answer or to do is reflected in the answer file.
Create a Ks.cfg file
[Email protected]~]# yum install-y System-config-kickstart
[[Email protected]~]# System-config-kickstart
KS.CFG Preview is as follows:

#platform =x86, AMD64, or Intel EM64T

#version =devel

# Firewall Configuration


# Install OS instead of upgrade


# Use Network Installation

URL--url= ""

# Root Password

ROOTPW--iscrypted $1$m7iicv7p$udxtdpf4oxxrqd2pi1o5t/

# System Authorization Information


# Use graphical Install



# System Keyboard

Keyboard US

# System Language

Lang en_US

# SELinux Configuration


# Installation Logging Level


# Reboot after installation


# System TimeZone

TimeZone Asia/shanghai

# Network Information


# System Bootloader Configuration


# Clear the Master Boot Record


# Partition Clearing Information


# Disk Partitioning Information

Part/--fstype= "EXT4"--size=15350

Part/boot--fstype= "Ext4"--size=

Part swap--fstype= "swap"--size=2048

Part/var--fstype= "Ext4"--grow--size=1
















Can directly use ks.cfg, according to their own needs to modify the firewall, URL, partition information (red marked place, note: root password is passw0rd)
It should be noted that the above operation is in the experimental environment, the server network card in the production environment is EM (x), the need to modify the section as follows:

[[Email protected]~]# Vim/var/lib/tftpboot/pxelinux.cfg/default


Append initrd=initrd.img ks= ksdrive=em1 #指定网卡


[[Email protected]~]# vim/var/www/html/ks.cfg




Test: The client can boot
If it is a new server, it is recommended to use PXE automatic installation, which guarantees the same initial system.

This article is from the "10995114" blog, please be sure to keep this source http://11005114.blog.51cto.com/10995114/1792217

PXE Batch automated installation system

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.