Create PXE Boot Server in Cent OS 6

Steps to install PXE Boot Server....

Following Server /VM Configuration which I have used in the test lab.

Hardware configuration :-
CPU                 2 Core
RAM                1 GB ( 1024 MB )
Hard Disk         40 GB
Network Card   1 ( NAT Network )

Application and Operating system :-
Hyper V            Oracle Virtual Box Build Version 4.3.18
Os                      Cent Os 6.6 Bit 64

Note :- PXE configuration also tested on OS like ( Cent Os 6.4 , RHEL 6.5, RHEL 6.6 )

Installation Steps....

> Create Virtual Machine in "Virtual Box" or  "VMware Workstation" Hyper-visor application.
    Note :- You can use Physical server or any other hyper-visor which are compatible with Cent /
                 RHEL linux 6

> Install Linux Operating system ( Cent Os 6 / RHEL 6 Bit 64 ) on Virtual / Physical machine.

>Configure Static IPv4 IP address to the linux server.
   Note :- I have configured IPv4 C-Class IP network 192.168.0.0 to my linux server.

>Enable Yum server and install "HTTP"service.
  Command :- #yum -y install httpd*    --- Loging as a root before installing httpd service.

>PXE Boot server require DHCP server to allocate IP address dynamically to new client.
  Install DHCP Server with Yum command.
  Command :- #yum -y install dhcpd* --- Loging as a root before installing dhcp service.

>Edit "dhcpd.conf" file
   DHCP file path :- /etc/dhcp/dhcpd.conf
   Command :- #cd /etc/dhcp/
                        #vi dhcpd.conf     ---- Use this command to edit the dhcpd.conf file.

>Update dhcpd.conf file with the following script.
ddns-update-style none;
option space PXE;
subnet 192.168.0.0 netmask 255.255.255.0 {
class "PXE" {
        match if substring(option vendor-class-identifier, 0, 9) = "PXEClient";
                option vendor-encapsulated-options 01:04:00:00:00:00:ff;
                        option boot-size 0x1;
                        filename "pxelinux.0";
                        option tftp-server-name "pxe.cloud.com";
                        option vendor-class-identifier "PXEClient";
                        vendor-option-space PXE;
}
        option routers 192.168.0.1;
        option subnet-mask 255.255.255.0;
        option domain-name "cloud.com";
        option domain-name-servers 192.168.0.10;
        default-lease-time 120;
        max-lease-time 180;
        next-server 192.168.0.10;
        range 192.168.0.11 192.168.0.20;
    # We actually use static IPs for serverX, but add these just in case...
    #include "/etc/dhcp/dhcpd-serverX.conf";
}

>Save the file with :wq command and exit.
Note:- option router ----  This is the gateway or router IP
           domain-name ---- Use this option if any domain controler is avalable in the lab
                        range ----  Specify DHCP IP range for PXE client.

>Restart DHCP server 
   Command :- #service dhcpd restart

>Enable DHCP service permanently 
   Command :- #chkconfig dhcpd on

>Disable linux firewall / Iptables
  Command :- #service iptables stop

>Disable Selinux seatings.
  Command :- #cd /etc/sysconfig/
                       #vi selinux     ---- Edit the file and disabled selinux seating.


Save the file and exit

> Create Cent Os directory to copy all the os installabels in html root directory.
   Command :- #mkdir /var/www/html/centos66 ----Create Os directory.
                        #cp -rv /media/centos6.6/* /var/www/html/centos66/  ---- Mount Cent Os media in /media directory and copy all the dvd contains to "centos66"directory 

>Restart HTTP server
   Command :- #service httpd restart

> Install TFTP server using Yum command
   Command :- #yum install tftp*
                        #chkconfig tftp on
                        #chkconfig xinetd on   ----Xinetd service use for PXE Boot.

>Go to TFTP directory
  Command :- #cd /usr/lib/tftpboot

>Create directories "centos/x86_64" "pxelinux.cfg" in tftpboot directory
   Command :- #mkdir -p centos/x86_64 pxelinux.cfg

>Copy initrd.img and vmlinuz files in x86_64 directory.
Command :- #cp -vr /var/www/html/centos66/pxeboot/initrd.img /var/lib/tftpboot/centos/x86_64/
                    #cp -vr /var/www/html/centos66/pxeboot/vmlinuz /var/lib/tftpboot/centos/x86_64/

>Go to "pxelinux.cfg"directory
  Command :- #cd ./pxelinux.cfg or #cd /usr/lib/tftpboot/pxelinux.cfg

>Create new file with the name "default"and put the following scripts in the file.
   Command :- #vi default

DEFAULT menu.c32

PROMPT 0

TIMEOUT 300

ONTIMEOUT localdisk

MENU TITLE PXE Network Boot

LABEL localdisk

        MENU LABEL ^Local Hard Drive

        MENU DEFAULT

        LOCALBOOT 0


LABEL install 64bit

        MENU Label ^CentOS 6.6 (64-bit) Install

        KERNEL centos/x86_64/vmlinuz

        APPEND initrd=centos/x86_64/initrd.img ramdisk_size=1024  method=http://192.168.0.10/centos66 lang=us
 

EOF
 :wq  

Save the file and exit
Note:- IP address 192.168.0.10 is my lab http server ip, Please change the IP of the server before   save and exit.

> Edit file /etc/xineted.d/tftp and Enable TFTP server to do change "disable=yes" to "no"
Command :- #vi /etc/xineted.d/tftp





>Install syslinux with YUM installer
Command :- #yum install syslinux*

>Copy pxelinux.0, menu.c32,memdisk,mboot.c32, chain.c32 to tftpboot directory.
Command:- #cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
                    #cp /usr/share/syslinux/menu.c32 /var/lib/tftpboot/
                    #cp /usr/share/syslinux/memdisk /var/lib/tftpboot/
                    #cp /usr/share/syslinux/mboot.c32 /var/lib/tftpboot/
                    #cp /usr/share/syslinux/chain.c32 /var/lib/tftpboot/


>Restart following services
Command :- #service dhcpd restart
                     #service xineted restart
                     #service httpd restart

PXE Boot server is ready to install new client.

Note :- This document is created to configure PXE Boot server to install Cent Os 6.6 only.




        





Comments

Popular posts from this blog

KVM Live Migration without Shared Storage

Create CentOS 6 Local package and Group package Repository

Create Linux ( LUCI ) Cluster