首先安装dhcp、tftp、vtp服务器
yum install dhcp -y
yum install tftp-server -y
yum install vsftp -y
配置dhcp服务器
vim /etc/dhcp/dhcpd.conf
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.10 192.168.1.20;
option routers 192.168.1.1;
}
next-server 192.168.1.200; -------》tftp服务器IP
filename "pxelinx.0";
3.利用图形化界面生成自动化脚本
yum install system-config-kickstart -y
system-config-kickstart
脚本名称保存为ks.cfg
vim ks.cfg
network --bootproto=dhcp --device=eth0 --onboot=on
# System bootloader configuration
bootloader --location=mbr --md5pass="$1$TGQjRc1M$e8cdqmCg7a7IJSdrivcbW0"
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel
# Disk partitioning information
part /boot --fstype="ext4" --size=200
part swap --fstype="swap" --size=1024
part / --fstype="ext4" --size=10240
%packages
@core
%post
echo "$(date +%F\ %H\:%M\:%S) > /root/install-date"
%end
并把编辑好的脚本复制到ftp服务器
cp ks.cfg /var/ftp/
4.挂载光盘,并把光盘的内容拷贝到ftp服务器的pub目录下
mount /dve/cdrom /opt
cp -rf /opt/* /var/ftp/pub
watch -n 1 du -sh /var/ftp/pub ---->可以查看进度
5.开启tftp服务,并把配置文件拷到tftp服务器
vim /etc/xinetd.d/tftp
[root@h01 ~]# yum install syslinux -y
[root@h01 ~]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
[root@h01 ~]# cp -rf /var/ftp/pub/isolinux/* /var/lib/tftpboot/
[root@h01 ~]# cd /var/lib/tftpboot/
[root@h01 tftpboot]# mkdir pxelinux.cfg
[root@h01 tftpboot]# cp isolinux.cfg pxelinux.cfg/default
[root@h01 pxelinux.cfg]# chmod 777 default
[root@h01 pxelinux.cfg]# vim default
label linux
menu label ^Install or upgrade an existing system
menu default
kernel vmlinuz
append initrd=initrd.img ks=ftp://192.168.1.200/ks.cfg
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
localboot 0xffff
label memtest86
menu label ^Memory test
kernel memtest
append -
6.关闭selinux、清空防火墙配置并且重启所有服务
[root@h01 ~]# setenforce 0
[root@h01 ~]# iptables -F
[root@h01 ~]# service dhcpd restart
[root@h01 ~]# service xinetd restart
[root@h01 ~]# service vstfpd restart