放大招,师父的blog.
PXE:
http://debugo.com/dnsmasq-pxe/
KICKSTART:
http://debugo.com/kickstart-install-centos/
一、PXE篇
1.配置PXE服务的工作都在/etc/dnsmasq.conf文件里:
# 【A】配置DHCP启动的程序 # Set the boot filename for netboot/PXE. You will only need # this is you want to boot machines over the network and you will need # a TFTP server; either dnsmasq's built in TFTP server or an # external one. (See below for how to enable the TFTP server.) dhcp-boot=pxelinux.0 # 【B】建立tftp服务(为dhcp-boot提供启动所需文件) # Enable dnsmasq's built-in TFTP server enable-tftp # Set the root directory for files availble via FTP. tftp-root=/tftp
2.安装syslinux
syslinux科普:
http://baike.baidu.com/view/3867652.htm?fr=aladdin
安装很简单:
yum install syslinux
3.在tftp目录放置需要的文件
【A】syslinux在远端机器运行所需的文件
安装后查看syslinux安装情况:
rpm -ql syslinux
syslinux运行所需文件目录:/usr/share/syslinux/
拷贝到tftp目录:
cp -rf /usr/share/syslinux/* /tftp/
【B】安装linux所需的ISOLinux文件
在linux的yum源或者安装文件里,有isolinux目录。
PXE运行时需要该目录下三个文件。
[1]启动镜像
*/isolinux/initrb.img
*/isolinux/vmlinuz
拷贝到tfpt根目录。
[2]安装配置文件
*/isolinux/isolinux.cfg
拷贝并变更文件名如下
/tftp/pxelinux.cfg/default
至此,pxe的配置完成。在本网段能够拿到由dnsmasq分发的IP,并通过网卡启动的机器,已经可以通过网络启动linux。
二、kickstart
使用kickstart进行远程安装
1.安装vsftpd及autofs作为安装镜像源
安装vsftpd:
http://chaihuo.blog.51cto.com/6386339/1426938
安装autofs:
http://chaihuo.blog.51cto.com/6386339/1426941
2.安装kickstart
yum install system-config-kickstart # 运行后根据图形界面提示生成kickstart文件ks.cfg system-config-kickstart
3.在pxelinux中配置ks.cfg
【a】将ks.cfg文件放到var/ftp/ (ftp根目录)
【b】编辑pxelinux配置文件,在initrd=initrd.img后加上ks=
ftp://ftpserver/ks.cfg
label linux menu label ^Install or upgrade an existing system menu default kernel vmlinuz append initrd=initrd.img ks=ftp://IPADDR/ks.cfg
4.在%end之前添加%post及内容
%post ####System hardening#### # close service chkconfig NetworkManager off chkconfig abrt-ccpp off %end
转载于:https://blog.51cto.com/bananalighter/1426789