Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Saturday, 19 November 2016

How to Install & Configure PXE Boot Server on CentOS/RHEL 6x

How to Install & Configure PXE Boot Server on CentOS/RHEL 6x


Q. What is PXE Boot Server ?

-- PXE Server, stands for preboot Execution Environment, is used to Enable a Network Computer to boot only from a Network interface card.

PXE Environment needs Following Services :

1. DHCP server that distributes the IP addresses to the client systems.
2. TFTP Server which makes bootable images available to be downloaded via network using
    Trivial File Transfer Protocol (TFTP).
3. Syslinux package which provides bootloaders for network booting.
4. http/ftp (any one) which will host the local mounted mirrored DVD (RHEL/CentOS6) image,
    from where the installer will extract its required packages.

PXE Server Details :

OS: CentOS 6.5 Minimal Installation
IP Address: 192.168.1.52/24
Hostname: pxe.domain.com
SELinux Disabled on PXE Server
IPtables Stopped on PXE Server

Step: 1. Bind Hosts File :

# vi /etc/hosts

192.168.1.50    pxe.domain.com    pxe

-- Save & Quit (:wq)

Step: 2. Disable Selinux & Stop Firewall :

# vi /etc/sysconfig/selinux

SELINUX=disabled

-- Save & Quit (:wq)

# service iptables stop
# chkconfig iptables off

Step: 3. Reboot the System :

# init 6

Step: 4. Install DHCP-Server, SYSLINUX Bootloaders, TFTP-Server, Web-Server 
                 (Apache httpd),  FTP-Server (Optional) :

# yum -y install dhcp tftp-server syslinux http ftp vsftpd

Step: 5. Configure HTTP/FTP Server :

# mkdir /var/lib/tftpboot/centos6
# mount -o loop /tmp/CentOS-6.iso /var/lib/tftpboot/centos6

# vi /etc/httpd/conf.d/pxeboot.conf

Alias /centos6 /var/lib/tftpboot/centos6
<Directory /var/lib/tftpboot/centos6>
      Options Indexes FollowSymLinks
          Order Allow,Deny
          Allow from all
</Directory>

-- Save & Quit (:wq)

# service httpd start
# chkconfig httpd on

Step: 6. Manually Browse to the Server IP & Verify if you can see all the Files :

http://192.168.1.50/centos6/

Step: 7. Enable the tftp Service in Xinetd :

# cp -r /usr/share/syslinux/* /var/lib/tftpboot/
# vi /etc/xinetd.d/tftp

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
}

-- Save & Quit (:wq)

# service xinetd start
# chkconfig xinetd on

Step: 8. Configure PXE Boot Server :

# mkdir /var/lib/tftpboot/pxelinux.cfg
# vi /var/lib/tftpboot/pxelinux.cfg/default

default menu.c32
prompt 0
timeout 300
ONTIMEOUT local
menu title ########## PXE Boot Menu ##########
label 1
menu label ^1) Install CentOS 6 Edition
kernel centos6/images/pxeboot/vmlinuz
append initrd=centos6/images/pxeboot/initrd.img method=http://192.168.1.52/centos6 devfs=nomount
label 2
menu label ^2) Boot from local drive localboot

-- Save & Quit (:wq)

Step: 9. Configure DHCP Server :

# vi /etc/sysconfig/dhcpd

DHCPDARGS=eth0

-- Save & Quit (:wq)

# vi /etc/dhcp/dhcpd.conf

option domain-name "pxe.domain.com";
option domain-name-servers 192.168.1.1, 8.8.8.8;
default-lease-time 600;
max-lease-time 7200;
log-facility local7;

subnet 192.168.1.0 netmask 255.255.255.0 {
    range 192.168.1.240 192.168.1.254;
    option routers 192.168.1.1;
    option broadcast-address 192.168.1.255;
}
allow booting;
    allow bootp;
    next-server 192.168.1.50;            # PXE Server IP Address.
    filename "pxelinux.0";

-- Save & Quit (:wq)

# service dhcpd restart
# service xinetd restart
# service httpd restart

# chkconfig dhcpd on
# chkconfig xinetd on

Note:

KERNEL - Defines the location from where the PXELINUX bootloader will load.
APPEND - Defines the location for PXE initrd image file to load.
FTP Server - There is not much Change for ftp server just replace the below line in the above file.

APPEND initrd=centos6/images/pxeboot/initrd.img method=ftp://192.168.1.6/centos6/ devfs=nomount


# mkdir /var/lib/tftpboot/centos6
OR
# mkdir /var/ftp/pub/centos6

# vi /etc/vsftpd/vsftpd.conf

anonymous_enable=YES
anon_root=/var/lib/tftpboot/centos6 # Specify the path

-- Save & Quit (:wq)

# service vsfptd restart
# chkconfig vsftpd on

ftp://192.168.1.50/centos6/

Step: 10. PXE Client Configuration :

The Client may be any System that has Network boot Enabled Option (PXE boot). You can Enable this Option in your BIOS Settings. That’s it. Now, power on the Virtual client system.

Once you have Reached PXE Menu, Choose your CentOS 6 Installation Type, hit Enter key & Continue with the Installation Procedure the same way as you might Install it from a Local Media Boot Device.

Thanks For Visiting on My Blog, For More Tutorials Keep Visiting My Blog


0 comments:

Post a Comment

Copyright © 2016 Kousik Chatterjee's Blog