首先安装需要使用到的软件
#yum -y install syslinux tftp-server dhcp httpd
将默认挂载在/media/cdrom 下的镜像链接到httpd的发布目录下# ln -s /media/cdrom/ /var/www/html/rhel6
#/etc/init.d/httpd start
配置tftp-server
# mkdir /var/lib/tftpboot/rhel6
# mkdir /var/lib/tftpboot/centos5
# cp /media/cdrom/isolinux/* /var/lib/tftpboot/rhel6 (其实有用的文件就是vmlinuz和initrd.img)
我很少用,所以执行这个的时候要把光盘换成centos5的,如果经常用的话,建议使用iso镜像挂载的方式,比较好
# cp /media/cdrom/isolinux/* /var/lib/tftpboot/centos5(其实有用的文件就是vmlinuz和initrd.img)
# cp /usr/lib/syslinux/pxelinux.0 /var/lib/tftpboot/ (未安装syslinux 就会找不到此文件)
# mkdir /var/lib/tftpboot/pxelinux.cfg
# cp /var/lib/tftpboot/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default
# vim /var/lib/tftpboot/pxelinux.cfg/default
…………………………
label linux
menu label install rhel6 system
menu default
kernel rhel6/vmlinuz
append initrd=rhel6/initrd.img ks=
label linux
menu label install centos5 system
kernel centos5/vmlinuz
append initrd=centos5/initrd.img ks=
label rescue
menu label ^Rescue rhel6 system
kernel rhel6/vmlinuz
append initrd=rhel6/initrd.img rescue
label rescue
menu label ^Rescue centos5 system
kernel centos5/vmlinuz
append initrd=centos5/initrd.img rescue
…………………………
#vim /etc/xinetd.d/tftp
修改disable = no
#/etc/init.d/xinetd start
配置dhcp服务器,使得客户端可以自动获取到ip地址
#vim /etc/dhcp/dhcpd.conf
ddns-update-style none;
subnet 10.76.28.0 netmask 255.255.255.0 {
range 10.76.28.75 10.76.28.80;
filename "pxelinux.0";
next-server 10.76.28.193;
}
#/etc/init.d/dhcpd start
最后记得设置开机自启动哦!
chkconfig tftp on
chkconfig xinetd on
chkconfig dhcpd on
chkconfig httpd on
这里推荐一下我们同学写得:
阅读(1608) | 评论(0) | 转发(0) |