1、创建ISO镜像存放路径,挂载ISO

    [root@host1 Desktop]# mkdir /dvd

    [root@host1 Desktop]# mkdir /root/isos/

    [root@host1 Desktop]#echo "/root/isos/rhel-server-7.1-x86_64-dvd.iso       /dvd    iso9660     loop    0 0" >> /etc/fstab

    [root@host1 Desktop]#mount -a

2、配置网卡地址

    cat > /etc/sysconfig/network-scripts/ifcfg-br0 <<EOF

    NAME=br0

    DEVICE=br0

    ONBOOT=yes

    BOOTPROTO=none

    TYPE=Ethernet

    IPADDR=192.168.1.254

    PREFIX=255.255.255.0

    EOF

 

3、配置Yum Client

wKioL1Z6v16hdYA3AAAkgp0r04w623.jpg

 

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/目录下生成如下目录树

wKioL1Z6v7KzQbgHAABEDcpWSCg323.jpg

     [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