Tuesday, 14 April 2015

Configure PXE Installation Server in CentOS7

A PXE Installation Server allows your client computers to boot and install Linux over the network.

 The following steps must be performed to prepare for a PXE installation
Step 1) Configure Installation server :- Provides the distribution tree for the installation

Step 2) Configure the tftp server necessary for PXE booting :- Provides files necessary to start the installation program.

Step 3) Configure the dhcp server :- Provides ip address of the tftp server and the loacation of files on tftp server

Install Packages

1) Install dhcp server

          sudo yum install dhcp

2) Install tftp server
          sudo yum install tftp-server

3) Install ftp server
           sudo yum install vsftpd

4) Install xinetd server
           sudo yum install xinetd

5) Install syslinux
           sudo yum install syslinux

IP Address of PXE Install Server:

Step 1) Configure Installation Server using FTP Server

1) Copy Installation Media from DVD or ISO File to '/var/ftp' directory
  1.1) Mount Iso file on  /mnt folder to create distribution tree
                sudo mount -o loop CentOS-7.0-1406-x86_64-DVD.iso  /mnt

  1.2) Copy distribution tree to '/var/ftp'
                sudo cp -a /mnt/.  /var/ftp

2) Change SELinux file context for FTP
                sudo chcon -R -t  public_content_t  /var/ftp 

3) Open ftp service in firewall
                 sudo firewall-cmd --zone=public --add-service=ftp --permanent
                 sudo firewall-cmd --reload

4) Start ftp service
                 sudo systemctl start vsftpd

5) Enable ftp  service on boot
                  sudo systemctl enable vsftpd

Step 2) Configure tftp Server

1) Edit the file '/etc/xinetd.d/tftp' and make the following changes.
           service tftp            {
                  socket_type = dgram
                  protocol = udp
                  wait = yes
                  user = root
                  server = /usr/sbin/in.tftpd
                  server_args = -s /var/lib/tftpboot
                  disable = no
                  per_source = 11
                  cps = 100 2
                  flags = IPv4

2) Make directory pxelinux in /var/lib/tftpboot
           sudo mkdir -p /var/lib/tftpboot/pxelinux

3) Copy file pxelinux.0 to /var/lib/tftpboot/pxelinux
         sudo cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/pxelinux

4) Copy file vesamenu.c32 to /var/lib/tftpboot/pxelinux
         sudo cp /usr/share/syslinux/vesamenu.c32 /var/lib/tftpboot/pxelinux

5) Make directory pxelinux.cfg in pxelinux directory
         sudo mkdir -p /var/lib/tftpboot/pxelinux/pxelinux.cfg

6) Create the file '/var/lib/tftpboot/pxelinux.cfg/default' and add following entry in it.
            default vesamenu.c32

          prompt 1

          timeout 600

          label linux

          menu label ^Install system

          menu default

          kernel vmlinuz

          append initrd=initrd.img ip=dhcp inst.repo=ftp//: 

7) Copy initrd.img and vmlinuz from /var/ftp/images/pxeboot folder of installation folder  to pxelinux
          sudo cp /var/ftp/images/pxeboot/vmlinuz /var/lib/tftpboot/pxelinux

          sudo cp /var/ftp/images/pxeboot/initrd.img  /var/lib/tftpboot/pxelinux

8) Open tftp service in firewall
        sudo firewall-cmd --zone=public –add-service=tftp –permanent
        sudo firewall-cmd --reload

9) Start xinetd service
         sudo systemctl start xinetd

Step 3) Configure Dhcp server

1) Edit /etc/dhcp/dhcpd.conf file

             option space pxelinux;

             option pxelinux.magic code 208 = string;

             option pxelinux.configfile code 209 = text;

             option pxelinux.pathprefix code 210 = text;

             option pxelinux.reboottime code 211 = unsigned integer 32;

             default-lease-time 600;

             max-lease-time 7200;

             subnet netmask




             allow booting;

             allow bootp;

             class "pxeclients" {

                      match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";


                      filename "pxelinux/pxelinux.0";


2) Open dhcp service in firewall
          sudo firewall-cmd --zone=public –add-service=dhcp –permanent
        sudo firewall-cmd --reload

3) Start dhcp service
         sudo systemctl start dhcp

No comments:

Post a Comment