Red Hat Enterprise Linux supports network installation using the NFS, FTP, or HTTP protocols. A network installation can be started from a boot CD-ROM or Red Hat Enterprise Linux CD #1, a bootable flash memory drive. Alternatively, Pre-Execution Environment (PXE) can also be used to install RHEL, if the system to be installed contains a network interface card (NIC) with Pre-Execution Environment (PXE) support.
How PXE works
The client's NIC with PXE support sends out a broadcast request for DHCP information and the DHCP server provides the client with an IP address, name server information, the hostname or IP address of the tftp server and the location of the installation files on the tftp server.
Basic steps required for preparation of PXE server
1. Configure the network (either NFS or FTP or HTTP) server to export the installation tree.
2. Configure the files on the tftp server necessary for PXE booting.
3. Configure DHCP
* Here we will use ftp server for our pxe installation server.
* In my case the media used is CD, if your OS is on DVD, few steps may vary.
Configuring vsftpd for PXE
Setting up vsftpd for basic use require just two steps. Installation of vsftpd rpm and starting the vsftpd service. We also need to chkconfig vsftpd so that vsftpd starts automatically when system reboots.
Step 1:
install vsftpd, if is not installed. On RHEL5. If RHEL5 is on CD, this file will be in CD-2:
- Code: Select all
rpm -ivh vsftpd-2.0.5-12.el5.i386.rpm
Step 2:
Starting vsftpd service as:
- Code: Select all
service vsftpd start
chkconfig --level 345 vsftpd on
Copying CDs to /var/ftp/pub
/var/ftp/pub directory path is automatically created when we install vsftpd rpm. So, now we need to copy all the cds in /var/ftp/pub/rhel5.3/
- Code: Select all
mkdir /var/ftp/pub/rhel5.3/
cp -rvf /media/RHEL-5.3\ i386\ Disc\ 1/* /var/ftp/pub/rhel5.3/
cp -rvf /media/RHEL-5.3\ i386\ Disc\ 2/* /var/ftp/pub/rhel5.3/
cp -rvf /media/RHEL-5.3\ i386\ Disc\ 3/* /var/ftp/pub/rhel5.3/
cp -rvf /media/RHEL-5.3\ i386\ Disc\ 4/* /var/ftp/pub/rhel5.3/
cp -rvf /media/RHEL-5.3\ i386\ Disc\ 5/* /var/ftp/pub/rhel5.3/
Configuring tftp for PXE
Step 1:
You need to install tftp, as it is not installed when you install your Linux box with "Customize Later" option selected. On RHEL5 it is present on CD-2 or CD-3 depending upon the version of RHEL5 you are using:
- Code: Select all
rpm -ivh tftp-server-0.42-3.1.i386.rpm
tftp-server is a xinetd dependent, if xinetd is not installed, you need to install xinetd rpm (which is present on CD-2) before can can successfully install tftp-server.
Step 2:
tftp is an xinetd based service, and requires to be started manually as:
- Code: Select all
chkconfig --level 345 tftp on
Configuring dhcp server for PXE
DHCP (Dynamic Host Configuration Protocol), is a network protocol for automatically not allowed TCP/IP information to client machines, which includes, IP address, gateway, and DNS Server information.
You need to install dhcp rpm, as it is not installed, when you install you system by selecting the option "Customize Later". The rpm dhcp-3.0.5-18.el5.i386.rpm is present in CD-3.
Configuration dhcpd.conf File
By default the dhcpd.conf file is not present in /etc/. The sample file is present at /usr/share/doc/dhcp<version>/dhcp.conf.sample which can be copied to /etc/ for use.
/etc/dhcpd.conf ;main configuration file
/var/lib/dhcp/dhcpd.leases ;store the client lease database
Configuring /etc/dhcpd.conf
192.168.1.100 is the ip address of my server on which I am configuring PXE.
After dhcpd.conf file is being configured, start dhcpd service and chkconfig it so that it start automatically on next boot.
- Code: Select all
service dhcpd start
chkconfig dhcpd on
PXE Boot configuration
The next step is to configure PXE boot configuration, so that tftp-server can serve client requests. This configuration can be done either through GUI tool system-config-netboot or through CLI using pxeos command.
[*] system-config-netboot is available if system-config-netboot-0.1.45.1-1.el5.noarch.rpm is installed.
[*] pxeos and pxeboot commands are available if system-config-netboot-cmd-0.1.45.1-1.el5.noarch.rpm is installed.
[*] Both system-config-netboot-0.1.45.1-1.el5.noarch.rpm and system-config-netboot-cmd-0.1.45.1-1.el5.noarch.rpm are present on CD-2.
[*] In this post I have mentioned how to use cmd tool to configure PXE boot, so, installation of system-config-netboot-0.1.45.1-1.el5.noarch.rpm is not required. Installation of system-config-netboot-cmd-0.1.45.1-1.el5.noarch.rpm will serve our purpose.
We need to execute the following command to configure PXE configuration as:
- Code: Select all
pxeos -a -i "Redhat 5.3" -p FTP -D 0 -s 192.168.1.100 -L /pub/rhel5.3/ redhat-el5.3
Where:
-a
add a new Operating System description
-i <description>
set short description not allowed with the Operating System.
-p <NFS | HTTP | FTP>
specify protocol used to access the Operating System
-D <1|0>
specify whether the configuration is diskless or not, zero specifies that it is not a diskless configuration
-s <server name or ip address>
specify the machine containing the Operating System
-L <netlocation>
specify the directory on the sever machine containing the Operating System.
<os-identifier>Specify the unique Operating System identifier, which is used as the directory name in the /tftpboot/linux-install/directory.
After execution pxeos command, the initrd.img and vmlinuz files required are transferred from
/var/ftp/pub/rhel5.3/images/pxeboot/ to /tftpboot/linux-install/<os-identifier>
In our case <os-identifier> is rhel5.3
At this stage, you can boot your PXE enabled system to install redhat 5.3. There are few other thinks we can configure in PXE, other than what I have wrote.
Writing such an short article is erring, so, If you find any error, plz don't hesitate to comment/correct.
Sunil Datta
