1、建立ISO鏡像存放路徑,掛載ISOlinux
[root@host1 Desktop]# mkdir /dvdbash
[root@host1 Desktop]# mkdir /root/isos/app
[root@host1 Desktop]#echo "/root/isos/rhel-server-7.1-x86_64-dvd.iso /dvd iso9660 loop 0 0" >> /etc/fstabdom
[root@host1 Desktop]#mount -asocket
2、配置網卡地址ide
cat > /etc/sysconfig/network-scripts/ifcfg-br0 <<EOFoop
NAME=br0ui
DEVICE=br0spa
ONBOOT=yesrouter
BOOTPROTO=none
TYPE=Ethernet
IPADDR=192.168.1.254
PREFIX=255.255.255.0
EOF
3、配置Yum Client
4、安裝須要的軟件包並關閉防火牆
yum install tftp-server syslinux nfs-* dhcp gpm bash-com* -y
systemctl stop firewalld
systemctl disable firewalld
5、安裝DHCP
cat > /etc/dhcp/dhcpd.conf << EOF
filename "pxelinux.0";
next-server 192.168.1.254;
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.1 192.168.1.250;
option domain-name-servers 192.168.1.254;
option domain-name "redhat.com";
option routers 192.168.1.254;
default-lease-time 600;
max-lease-time 7200;
}
EOF
6、打開DHCP並重啓
systemctl enable dhcpd
systemctl start dhcpd
7、配置TFTP服務
配置TFTP,使/var/lib/tftpboot/目錄下生成以下目錄樹
[root@host1 ~]# cd /var/lib/tftpboot/
[root@host1 tftpboot]# mkdir pxelinux.cfg
[root@host1 tftpboot]# cp /dvd/isolinux/* /var/lib/tftpboot/
[root@host1 tftpboot]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
[root@host1 tftpboot]# mv isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default
8、更改/var/lib/tftpboot/ pxelinux.cfg/default文件中的以下部分
#原有配置:
label linux
menu label ^Install Red Hat Enterprise Linux 7.1
kernel vmlinuz
append initrd=initrd.img inst.stage2=hd:LABEL=RHEL-7.1\x20Server.x86_64 quiet
#最終配置
label linux
menu label ^Install Red Hat Enterprise Linux 7.1
kernel vmlinuz
append initrd=initrd.img inst.stage2=nfs://192.168.1.254/dvd
9、開啓服務並重啓
systemctl enable xinetd
systemctl enable tftp.socket
systemctl start xinetd
systemctl start tftp.socket
10、生成配置
echo "/dvd *(ro,sync)" > /etc/exports
11、重啓nfs並從新啓動系統
systemctl enable nfs-server
systemctl start nfs-server
reboot