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:192.168.153.2
1. Installing the Software
[[Email protected]~]# yum-y Install DHCP tftp-server httpd syslinux
2.dhcp
[[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 192.168.153.0 netmask 255.255.255.0 { #设置网段
option routers 192.168.153.1;
Option Subnet-mask 255.255.255.0; #设置掩码子网
Range DYNAMIC-BOOTP 192.168.153.50 192.168.153.100; #设置dhcp服务器IP地址租用的范围, DYNAMIC-BOOTP on behalf of the DHCP server to support PXE
Default-lease-time 64600; #默认租约时间
Max-lease-time 43200; #最大租约时间
Next-server 192.168.153.2; #tftp服务器地址
FileName "pxelinux.0"; #最基本的启动文件. Pointing to the root directory of the Tftp-sever
}
[[Email protected]~]# service DHCPD restart
[[Email protected]~]# chkconfig DHCPD on
3.tftp
(1). pxelinux.0
[[email protected] ~]# Find/-name pxelinux.0
/usr/share/syslinux/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=http://192.168.153.2/ks.cfg #指定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 0.0.0.0:69 0.0.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
Firewall--disabled
# Install OS instead of upgrade
Install
# Use Network Installation
URL--url= "http://192.168.153.2/centos6.6"
# Root Password
ROOTPW--iscrypted $1$m7iicv7p$udxtdpf4oxxrqd2pi1o5t/
# System Authorization Information
Auth--useshadow--passalgo=sha512
# Use graphical Install
Graphical
Firstboot--disable
# System Keyboard
Keyboard US
# System Language
Lang en_US
# SELinux Configuration
SELinux--disabled
# Installation Logging Level
Logging--level=info
# Reboot after installation
Reboot
# System TimeZone
TimeZone Asia/shanghai
# Network Information
Network--bootproto=dhcp--device=eth0--onboot=on
# System Bootloader Configuration
Bootloader--LOCATION=MBR
# Clear the Master Boot Record
Zerombr
# Partition Clearing Information
Clearpart--all--initlabel
# 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
%packages
@base
@basic-desktop
@desktop-debugging
@desktop-platform
@fonts
@general-desktop
@graphical-admin-tools
@input-methods
@internet-applications
@legacy-X
@print-client
@remote-desktop-clients
@x11
%end
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=http://192.168.153.2/ks.cfg ksdrive=em1 #指定网卡
...
[[Email protected]~]# vim/var/www/html/ks.cfg
...
network--bootproto=dhcp--device=em1--onboot=on
...
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