在CentOS6上利用PXE+Kickstart+Apache+DHCP实现无人值守安装
1.PXEServer:
OS:CentOS6.9
IP:172.16.25.69;
(1)apache;
# mount /dev/cdrom /media/cdrom
# yum install httpd -y
# vim /etc/httpd/conf/httpd.conf
......
Listen 172.16.25.69:80
DocumentRoot "/media"
<Directory "/media">
......
# /etc/init.d/httpd start
# elinks http://172.16.25.69
(2)tftp;
# yum install tftp-server xinetd -y
# cd /etc/xinetd.d
# cp tftp{,.bak}
vim /etc/xinetd.d/tftp
......
server_args = -s /tftpboot
disable = no
......
# chkconfig tftp on
# /etc/init.d/xinetd start
(3)DHCP;
# yum install dhcp -y
# vim /etc/dhcp/dhcpd.conf
subnet 172.16.25.0 netmask 255.255.255.0 {
range 172.16.25.101 172.16.25.200;
option broadcast-address 172.16.25.255;
default-lease-time 600;
max-lease-time 7200;
next-server 172.16.25.69;
filename "pxelinux.0";
}
# /etc/init.d/dhcpd start
(4)Kickstart;
# mkdir -pv /tftpboot
# yum install syslinux -y
# cp /usr/share/syslinux/pxelinux.0 /tftpboot
# cp -a /media/cdrom/images/pxeboot/initrd.img /tftpboot
# cp -a /media/cdrom/images/pxeboot/vmlinuz /tftpboot
# mkdir -pv /tftpboot/pxelinux.cfg
# cp /media/cdrom/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default
# chmod 644 /tftpboot/pxelinux.cfg/default
# vim pxelinux.cfg/default
default linux
......
label linux
menu label ^Install or upgrade an existing system
menu default
kernel vmlinuz
append initrd=initrd.img ks=http://172.16.25.69/ks.cfg
# yum install system-config-kickstart -y
//run system-config-kickstart with Xstart & save ks.cfg to /media
# cat ks.cfg
#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
# Firewall configuration
firewall --disabled
# Install OS instead of upgrade
install
# Use network installation
url --url="http://172.16.25.69/cdrom/"
# Root password
rootpw --plaintext 111111
# System authorization information
auth --useshadow --passalgo=sha512
# Use text mode install
text
# System keyboard
keyboard us
# System language
lang en_US
# SELinux configuration
selinux --disabled
# Do not configure the X Window System
skipx
# 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 /boot --asprimary --fstype="ext4" --size=300
part swap --fstype="swap" --size=1024
part / --fstype="ext4" --grow --size=1
%packages
@development
@server-platform
git
%end
2.PXEClient:
CentOS6.9