In this post, we are going to see how to install and configure a server installation with several distribution Centos/Fedora/Redhat/Oracle Linux through the network as a base system using CentOS Server with DHCP,vsftp,TFTP,Xinet services.
The term PXE refers to the preboot execution environment (Preboot eXecution Environment).
The feature of this PXE is used to boot and install the operating system on computers via a network, so no need of manual installations.
DHCP/PXE Server:
server.local, IP address: 192.168.1.5
Step 1: Install and configure DHCP
[root@server.local ~]# yum install dhcp
[root@server.local ~]# vi /etc/dhcp/dhcpd.conf
ddns-update-style interim;
not authoritative;
option domain-name "example.com";
option domain-name-servers 192.168.1.100, 192.168.1.200;
option subnet-mask 255.255.255.0;
subnet 192.168.1.0 netmask 255.255.255.0
{
authoritative;
range 192.168.1.10 192.168.1.254;;
allow unknown-clients;
allow booting;
allow bootp;
next-server 192.168.1.5;
filename "pxelinux.0";
}
Step 2: Install and configure VSFTP& TFTP
[root@server.local ~]# yum install vsftp
[root@server.local ~]# yum install tftp-server
[root@server.local ~]# vi /etc/xinetd.d/tftp
Change the disable variable to “no”
disable=no
Create the essential directories
[root@server.local ~]# mkdir /tftpboot/
[root@server.local ~]# mkdir /tftpboot/images
[root@server.local ~]# mkdir /tftpboot/pxelinux.cfg
[root@server.local ~]# chmod -R 777 /tftpboot/
Copy pxelinux.0 & menu.c32 files to /tftpboot directory
[root@server.local ~]# cp /usr/lib/syslinux/pxelinux.0 /tftpboot/
[root@server.local ~]# cp /usr/lib/syslinux/menu.c32 /tftpboot/
Create the PXE menu config file
[root@server.local ~]# vi /tftpboot/pxelinux.cfg/default
DEFAULT menu.c32
PROMPT 0
TIMEOUT 600
MENU TITLE Network Installation
Step 3: Copy linux distribution source to /tftpboot directory
[root@server.local ~]# mkdir /mnt/cdrom
[root@server.local ~]# mount /dev/sr0 /mnt/cdrom
CentOS 6
[root@server.local ~]# mkdir /tftpboot/images/centos/6/x86_64/
[root@server.local ~]# mkdir /var/ftp/centos/6/x86_64/
[root@server.local ~]# cp -R /mnt/cdrom/* /var/ftp/centos/6/x86_64/
[root@server.local ~]# cp /var/ftp/centos/6/x86_64/images/pxeboot/vmlinuz /tftpboot/images/centos/6/x86_64/
[root@server.local ~]# cp /var/ftp/centos/6/x86_64/images/pxeboot/initrd.img /tftpboot/images/centos/6/x86_64/
Add Centos entry on PXE menu:
[root@server.local ~]# vi /tftpboot/pxelinux.cfg/default
Add the below lines in EOF
LABEL Centos 6 (x86_64)
KERNEL images/centos/6/x86_64/vmlinuz
APPEND vga=normal initrd=images/centos/6/x86_64/initrd.img ramdisk_size=32768
METHOD=ftp://192.168.1.5/centos/6/x86_64/
Redhat 5
[root@server.local ~]# mkdir /tftpboot/images/redhat/5/i386
[root@server.local ~]# mkdir /var/ftp/redhat/5/i386
[root@server.local ~]# cp -R /mnt/* /var/ftp/redhat/5/i386/
[root@server.local ~]# cp /var/ftp/redhat/5/i386/vmlinuz /tftpboot/images/redhat/5/i386/
[root@server.local ~]# cp /var/ftp/redhat/5/i386/initrd.img /tftpboot/images/redhat/5/i386/
Add Redhat entry on PXE menu:
[root@server.local ~]# vi /tftpboot/pxelinux.cfg/default
Add the below lines in EOF
LABEL Redhat Enterprise Linux 5
KERNEL images/redhat/5/i386/vmlinuz
APPEND vga=normal initrd=images/redhat/5/i386/initrd.img ramdisk_size=32768
METHOD=ftp://192.168.1.5/redhat/5/i386/
Step 4: Start or restart the necessary daemons
[root@server.local ~]# service vsftpd restart
[root@server.local ~]# service xinetd restart
[root@server.local ~]# service nfs restart
[root@server.local ~]# service dhcpd restart
Make the daemons start at boot level
[root@server.local ~]# chkconfig vsftpd --level 35 on
[root@server.local ~]# chkconfig xinetd --level 35 on
[root@server.local ~]# chkconfig nfs --level 35 on
[root@server.local ~]# chkconfig dhcpd --level 35 on
Now your PXE server is ready. Change your desktop boot level to network, after save and exit machine will boot from dhcp and PXE menu will appear to select the OS to be install on the desktop.