kickstart部署

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

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章