系统环境:
[root@kickstart ~]# cat /etc/redhat-release CentOS release 6.5 (Final) [root@kickstart ~]# uname -a Linux kickstart 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux [root@kickstart ~]# lsb_release -a LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch Distributor ID: CentOS Description: CentOS release 6.5 (Final) Release: 6.5 Codename: Final
开始安装:
[root@kickstart ~]# yum -y install rsync httpd vixie-cron dhcp tftp-server syslinux make perl [root@kickstart ~]# cat <<EOF >/etc/dhcp/dhcpd.conf > subnet 172.16.10.0 netmask 255.255.255.0 { > option routers 172.16.10.254; > option subnet-mask 255.255.255.0; > option domain-name "linux.com.cn"; > option domain-name-servers 114.114.114.114; > filename "pxelinux.0"; > next-server 172.16.10.10; > option time-offset -18000; # Eastern Standard Time > range dynamic-bootp 172.16.10.200 172.16.10.220; > default-lease-time 21600; > max-lease-time 43200; > } > EOF [root@kickstart ~]# /etc/init.d/dhcpd start Starting dhcpd: [ OK ] [root@kickstart ~]# netstat -tulnpan|grep dhcp udp 0 0 0.0.0.0:67 0.0.0.0:* 1204/dhcpd [root@kickstart ~]# vim /etc/xinetd.d/tftp server_args = -s /tftpboot disable = no [root@kickstart ~]# service xinetd start Starting xinetd: [ OK ] [root@kickstart ~]# netstat -tulnpan |grep xinet udp 0 0 0.0.0.0:69 0.0.0.0:* 1220/xinetd [root@kickstart ~]# cd / [root@kickstart /]# mkdir tftpboot [root@kickstart /]# cd ~ [root@kickstart ~]# mkdir /var/www/html/centos6 [root@kickstart ~]# mount /dev/cdrom /var/www/html/centos6 mount: block device /dev/sr0 is write-protected, mounting read-only [root@kickstart ~]# /etc/init.d/httpd start [root@kickstart ~]# cp /var/www/html/centos6/p_w_picpaths/pxeboot/{vmlinuz,initrd.img} /tftpboot/ [root@kickstart ~]# cp /var/www/html/centos6/isolinux/{boot.msg,vesamenu.c32,splash.jpg} /tftpboot/ [root@kickstart ~]# cp /usr/share/syslinux/pxelinux.0 /tftpboot/ [root@kickstart ~]# mkdir -p /tftpboot/pxelinux.cfg #[root@kickstart ~]# cp /var/www/html/centos6/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default [root@kickstart ~]# cd /var/www/html/ [root@kickstart html]# mkdir ks [root@kickstart html]# cd ks/ [root@kickstart ks]# vim centos6.5.cfg install text url --url=http://172.16.10.10/centos6/ lang en_US keyboard us network --onboot yes --bootproto dhcp --noipv6 rootpw redhat authconfig --enableshadow --passalgo=sha512 selinux --disabled timezone --utc Asia/Shanghai bootloader --location=mbr #clearpart --none zerombr yes clearpart --all --initlabel part swap --fstype="swap" --size=1024 part /boot --fstype="ext4" --size=200 part / --fstype="ext4" --size=51200 part /data --fstype="ext4" --grow --size=1 reboot %packages @base vim lftp lrzsz telnet %post #rpm -e NetworkManager-gnome #rpm -e NetworkManager # Limits configure echo "* soft nofile 65535" >> /etc/security/limits.conf echo "* hard nofile 65535" >> /etc/security/limits.conf echo "* soft nproc 65535" >> /etc/security/limits.conf echo "* hard nproc 65535" >> /etc/security/limits.conf echo "ulimit -SHu 65535" >> /etc/rc.local # ntpdate echo "01 * * * * ntpdate time.windows.com;hwclock -w" > /var/spool/cron/root # clean install info echo "" > /root/anaconda-ks.cfg %end [root@kickstart ks]# cd /tftpboot/pxelinux.cfg/ [root@kickstart pxelinux.cfg]# vim default default local timeout 600 display boot.msg prompt 1 label local localboot 0xffff label rescue kernel vmlinuz append initrd=initrd.img rescue label 1 kernel vmlinuz append initrd=initrd.img ks=http://172.16.10.10/ks/centos6.5.cfg label 2 kernel vmlinuz append initrd=initrd.img [root@kickstart pxelinux.cfg]# cd .. [root@kickstart tftpboot]# mv boot.msg boot.msg.bak [root@kickstart tftpboot]# vim boot.msg http://nowsafe.blog.51cto.com - To install or upgrade CentOS-6.5 ------- Please Input 1 <Enter> key
至此可以pxe引导和安装系统了