CONTACT @ Skype : rajdimdung   |   call : +977 9841813550

Network Install Using PXE ( Preboot Execution Environment)

Post by :    Date : 2014-11-30 01:36:10

  • Share on Facebook

Network Install Using PXE ( Preboot Execution Environment)


Yum Server: To install the packages (for DHCP, TFTP, FTP, NFS or HTTP) 
DHCP Server: To boot client with DHCP services/ Automatic IPs for clients TFTP 
Server : PXE FTP/NFS/HTTP Server: Repo

Configure Network:

Server -> (Static)
Client -> (DHCP)

Configure Yum Repot via DVD:

#Insert DVD 
#umount /dev/sr0 
#mount /dev/sr0 /media 

[root@dlab108 ~]#cat /etc/yum.conf
[root@dlab108 ~]#

Step #1 // Mount CD/DVD

[root@dlab108 ~]# mount /dev/cdrom /media 
[root@dlab108 ~]# du -sh /media/ 
3.2G  /media/
[root@dlab108 ~]# df -h /media 
Filesystem Size  Used Avail Use% Mounted on 
/dev/sr0 3.2G  3.2G     0 100% /media 
[root@dlab108 ~]#

Step #2 // Create Local yum using /etc/yum.conf , at end of this file add the following parameter.

[root@dlab108 ~]# cat /etc/yum.conf 

#This is the default, if you make this bigger yum won't see if the metadata  
# is newer on the remote and so you'll "gain" the bandwidth of not having to 
# download the new metadata and "pay" for it by yum not having correct  
# information 
#  It is esp. important, to have correct metadata, for distributions like  
# Fedora which don't keep old packages around. If you don't like this checking 
# interupting your command line usage, it's much better to have something 
# manually check the metadata once an hour (yum-updatesd will do this). 
# metadata_expire=90m 
[root@dlab108 ~]# 

// Add YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d
[root@dlab108 ~]# vim /etc/yum.repos.d/file.repo 
[root@dlab108 ~]# 

Step # 3 // Verify the Yum server is working or not using yum "repolist" command

[root@dlab108 ~]# yum repolist 
Loaded plugins: product-id, security, subscription-manager 
Updating certificate-based repositories 
Unable to read consumer identity 
repo id    repo name status
     001   Server  3,391 
repolist: 3,391 
[root@dlab108 ~]# 

Step # 4 // Install required Packages

[root@dlab108 ~]# yum install dhcp ftfp-server syslinux httpd vsftpd nfs-utils system-config-kickstart
[root@dlab108 ~]# yum -y install dhcp tftp-server syslinux httpd vsftpd nfs-util 

Step # 5 // Configure DHCP Server:

# allowing booting
# allow bootp 
# authoritative 

subnet netmask { 
range dynamic-bootp; 
default-lease-time 600; 
max-lease-time 1200; 
filename "pxelinux.0"

// Configure DHCP by editing /etc/dhcp/dhcp.conf, you can manually type or you can copy like below 

[root@dlab108 ~]# cp /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/dhcp/dhcpd.conf
cp: overwrite `/etc/dhcp/dhcpd.conf'? y
[root@dlab108 ~]#

// Sample Configuration File should be like below 

[root@dlab108 ~]# cat /etc/dhcp/dhcpd.conf
default-lease-time 600;
max-lease-time 7200;

allow booting; 
allow bootp; 

// configuration for an internal subnet. 
subnet netmask { 
filename "pxelinux.0"; 

// Make sure you have setup service is available on onboot 

[root@dlab108 ~]# chkconfig dhcpd on 
[root@dlab108 ~]# chkconfig --list dhcpd 
dhcpd   0:off   1:off   2:on  3:on  4:on  5:on  6:off 
[root@dlab108 ~]# /etc/init.d/dhcpd restart 
Shutting down dhcpd: OK 
Starting dhcpd: OK 
[root@dlab108 ~]#

Step # 6 // Configure TFTP Server :

// Edit the /etc/xinet.d/tftp file and change disable = no to yes, by default tftp server will be disable and tftp server will control by xinetd
[root@dlab108 ~]# vi /etc/xinetd.d/tftp 
disable = no 

save  and exit 

cp  -av /media/isolinux/* /var/lib/tftpboot 
mkdir /var/lib/tftpboot/prelinux.cfg 
cp /var/lib/tftpboot/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default 
cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/ 

[root@dlab108 ~]# cat /etc/xinetd.d/tftp 
# default: off 
# description: The tftp server serves files using the trivial file transfer  
# protocol.  The tftp protocol is often used to boot diskless  
# workstations, download configuration files to network-aware printers,  
# and to start the installation process for some operating systems. 
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 
[root@dlab108 ~]# 

Steps #7 - 

[root@dlab108 tftpboot]# cp -av /media/isolinux/* /var/lib/tftpboot 
[root@dlab108 tftpboot]# mkdir /var/lib/tftpboot/pxelinux.cfg 
[root@dlab108 tftpboot]# ls -ld /var/lib/tftpboot/pxelinux.cfg 
drwxr-xr-x 2 root root 4096 Jun  9 10:44 /var/lib/tftpboot/pxelinux.cfg 
[root@dlab108 tftpboot]# cp /var/lib/tftpboot/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default 
[root@dlab108 tftpboot]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/ 
[root@dlab108 tftpboot]# 

// Now Start TFPT Server  
[root@dlab108 tftpboot]# service xinetd start 
Starting xinetd: 
[root@dlab108 tftpboot]# 
[root@dlab108 tftpboot]# chkconfig xinetd on 
[root@dlab108 tftpboot]# chkconfig --list xinetd 
xinetd 0:off  1:off 2:on 3:on 4:on 5:on 6:off
[root@dlab108 tftpboot]#

Step # 7 // Configure FTP/HTTP/NFS Server:

[root@dlab108 ~]#cp -vr /media/* /var/ftp/pub 
[root@dlab108 ~]#vi /etc/vsftpd/vsftpd.conf 
anon_root=/rhel6 anonymous_enable=YES 

// Make the following directories
[root@dlab108 ~]# mkdir -p /var/www/html/pub/RH6U0-64 
[root@dlab108 ~]# cp -avr /media/* /var/www/html/pub/RH6U0-64/ 
Or // Copy all files into /var/ftp/pub 
[root@dlab108 ~]# cp -vr /media/* /var/ftp/pub/ 

// Verify if anonymous_enable=YES on /etc/vsftpd/vsftpd.conf file if not edit and do enable 
[root@dlab108 ~]# grep anonymous_enable /etc/vsftpd/vsftpd.conf anonymous_enable=YES 
[root@dlab108 ~]# 
[root@dlab108 ~]# /etc/init.d/vsftpd restart 
Shutting down vsftpd: [FAILED] 
Starting vsftpd for vsftpd: OK 
[root@dlab108 ~]# chkconfig vsftpd on 
[root@dlab108 ~]# 
[root@dlab108 ~]# sestatus 
SELinux status: disabled 
[root@dlab108 ~]#

Step # 8 All steps done, lets restart the service for all the configured servers.

[root@dlab108 ~]# /etc/init.d/dhcpd restart  
Shutting down dhcpd: OK 
Starting dhcpd: OK  
[root@dlab108 ~]# /etc/init.d/xinetd restart
Stopping xinetd: OK  
Starting xinetd: OK  
[root@dlab108 ~]# /etc/init.d/vsftpd restart 
Shutting down vsftpd:OK  
Starting vsftpd for vsftpd: OK 
[root@dlab108 ~]#

Now you can power on your client server where you want to install the OS, the system should boot with Network

Related Posts