yum -y install syslinux
cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
cd /App/web/CentOS-6.6-x86_64/isolinux/
cp vesamenu.c32 boot.msg splash.jpg vmlinuz initrd.img memtest /var/lib/tftpboot/
mkdir -p /var/lib/tftpboot/pxelinux.cfg
cp isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default
修改启动菜单/var/lib/tftpboot/pxelinux.cfg/default,特别注意menu default这个配置决定了默认启动哪个选项,如果是【label linux】下,服务器一旦重启将删除所有分区并格式化,非常危险,一定要修改此项。
default vesamenu.c32
prompt 0
timeout 60
display boot.msg
menu background splash.jpg
menu title Welcome to CentOS 6.6!
menu color border 0 #ffffffff #00000000
menu color sel 7 #ffffffff #ff000000
menu color title 0 #ffffffff #00000000
menu color tabmsg 0 #ffffffff #00000000
menu color unsel 0 #ffffffff #00000000
menu color hotsel 0 #ff000000 #ffffffff
menu color hotkey 7 #ffffffff #ff000000
menu color scrollbar 0 #ffffffff #00000000
label linux
menu label ^Install or upgrade an existing system
kernel vmlinuz
append initrd=initrd.img ks=http://192.168.200.10/CentOS-6.6-x86_64/ks.cfg ksdevice=em1
label vesa
menu label Install system with ^basic video driver
kernel vmlinuz
append initrd=initrd.img xdriver=vesa nomodeset
label rescue
menu label ^Rescue installed system
kernel vmlinuz
append initrd=initrd.img rescue
label local
menu label Boot from ^local drive
menu default
localboot 0xffff
label memtest86
menu label ^Memory test
kernel memtest
append -
四、添加Kickstart配置
Web目录中添加kickstart配置文件/App/web/CentOS-6.6-x86_64/ks.cfg
install
keyboard us
lang zh_CN
url --url=http://192.168.200.10/CentOS-6.6-x86_64/
network --onboot yes --device eth0 --bootproto dhcp --noipv6
rootpw --iscrypted $6$y0UTGMGnCEgUJmUB$IPcaQ8ipx24V8lAq.XepGoilvjXM9kFs5YrivQQoejYmLOmeVXSeM6IvzxtdsUJ0CFuTMzANEmlj5FOluuwy40
auth --useshadow --passalgo=sha512
reboot
firewall --disabled
firstboot --disable
selinux --disabled
logging --level=info
timezone Asia/Shanghai
bootloader --location=mbr
zerombr yes
clearpart --all --initlabel
part /boot --fstype ext4 --size=200
part swap --size=2048
part / --fstype ext4 --size=200 --grow
%packages
@chinese-support
@core
@server-policy
@workstation-policy
%end
%post
ServiceList=`chkconfig --list | grep '0' | awk '{print $1}' | grep -Ev 'sshd|network|crond|syslog'`
for Service in $ServiceList
do
/etc/init.d/$Service stop
chkconfig --level 0123456 $Service off
done
cat >> /etc/sysctl.conf << EOF
vm.swappiness = 0
net.core.rmem_default = 262144
net.core.rmem_max = 16777216
net.core.wmem_default = 262144
net.core.wmem_max = 16777216
net.core.somaxconn = 262144
net.core.netdev_max_backlog = 262144
net.ipv4.tcp_max_orphans = 262144
net.ipv4.tcp_max_syn_backlog = 262144
net.ipv4.tcp_max_tw_buckets = 10000
net.ipv4.ip_local_port_range = 1024 65500
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_synack_retries = 1
net.ipv4.tcp_syn_retries = 1
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_time = 1200
net.ipv4.tcp_mem = 786432 1048576 1572864
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
fs.inotify.max_user_watches = 1048576
EOF
sysctl -p
cat >> /etc/security/limits.conf << EOF
* - nofile 1048576
* - nproc 65536
* - stack 1024
EOF
cat >> /etc/profile << EOF
ulimit -n 1048576
ulimit -u 65536
ulimit -s 1024
alias grep='grep --color=auto'
export HISTTIMEFORMAT="%Y-%m-%d %H:%M:%S "
EOF
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
setenforce 0
sed -i 's/.*UseDNS yes/UseDNS no/' /etc/ssh/sshd_config
sed -i 's/.*GSSAPIAuthentication yes/GSSAPIAuthentication no/' /etc/ssh/sshd_config
/etc/init.d/sshd restart
cat >> $HOME/.bash_profile << EOF
export PATH=/App/script:\$PATH
EOF
mkdir -p /App/script /App/src
mount --bind /dev/shm /tmp
echo "/bin/mount --bind /dev/shm /tmp" >> /etc/rc.local
五、检查相关服务监听端口
http:80、dhcp:67、tftp:69
netstat -tunlp | grep -E '(0.0.0.0:80|0.0.0.0:67|0.0.0.0:69)'
如下图说明各服务已监听
Linux 基础教程:Linux Kickstart 自动安装
使用PXE+DHCP+Apache+Kickstart无人值守安装CentOS5.8 x86_64
Linux PXE无人值守安装出现 PXE-E32:TFTP OPen timeout的解决办法