Friday, August 9, 2013

How to Install Red hat Linux from a PXE boot install envronment







Installing Red hat Linux from a PXE Boot Install Environment


Red Hat Enterprise Linux allows for installation over a network using the NFS, FTP, or HTTP protocols. A network installation can be started from a boot CD-ROM, a bootable flash memory drive, or by using the askmethod boot option with the Red Hat Enterprise Linux CD #1. Alternatively, if the system to be installed contains a network interface card (NIC) with Pre-Execution Environment (PXE) support, it can be configured to boot from files on another networked system rather than local media such as a CD-ROM.

For a PXE network installation, the client's NIC with PXE support sends out a broadcast request for DHCP information. The DHCP server provides the client with an IP address, other network information such as name server, the IP address or hostname of the tftp server (which provides the files necessary to start the installation program), and the location of the files on the tftpserver. This is possible because of PXELINUX, which is part of the syslinux package.

The following steps must be performed to prepare for a PXE installation:

·         Configure the network (NFS, FTP, HTTP) server to export the installation tree.
·         Configure the files on the tftp server necessary for PXE booting.
·         Configure which hosts are allowed to boot from the PXE configuration.
·         Start the tftp service.
·         Configure DHCP.
·         Boot the client, and start the installation.

OS : Centos 6 32 Bit

Step: 1 - Make sure some pre-requisites are in place:

# yum update
# yum install tftp-server xinetd pygtk2-libglade gnome-python2-canvas nfs* dhcp* syslinux

Step: 2 - Sharing iso image with NFS

Download CentOS-6.0-i386-bin-DVD.iso file from internet, and create a folder called data and move that iso image to  /data

#  mkdir /data
# chmod -R 777 /data
# mount -o loop /root/Downloads/CentOS-6.0-i386-bin-DVD.iso /data

And share that iso image with NFS

# vi /etc/exports
   /data/                                *(rw,sync)

:wq!

Then start the NFS service

# service nfs restart
# setenforce 0
# service iptables stop







Step : 3 -
Starting the tftp Server


Edit /etc/xinet.d/tftp file to run the tftp service under xinetd daemon. Modify the following lines in the conf file as follows:

# vi /etc/xinet.d/tftp

disable                     = no

server_args             = -s /tftpboot


:wq!

tftp is an xinetd-based service; start it with the following commands:

# service xinetd restart
# /sbin/chkconfig --level 345 xinetd on
# /sbin/chkconfig --level 345 tftp on

Step : 4 - DHCP Server configuration

For configuring DHCP Server please copy paste the following configurations in to /etc/dhcpd/dhcpd.conf file

# vi /etc/dhcpd/dhcpd.conf

ddns-update-style interim;
ignore client-updates;

subnet 192.168.1.0 netmask 255.255.255.0 {

# --- default gateway
      option routers                192.168.1.1;
      option subnet-mask            255.255.255.0;

      option nis-domain       "domain.org";
      option domain-name            "domain.org";
      option domain-name-servers    192.168.1.100;

      option time-offset            -18000;     # Eastern Standard Time
#     option ntp-servers            192.168.1.1;
#     option netbios-name-servers   192.168.1.1;
# --- Selects point-to-point node (default is hybrid). Don't change this unless
# -- you understand Netbios very well
#     option netbios-node-type 2;

      range dynamic-bootp 192.168.1.200 192.168.1.240;
      default-lease-time 21600;
      max-lease-time 43200;

allow booting;
allow bootp;
class "pxeclients" {
   match if substring(option vendor-class-identifier, 0, 9) = "PXEClient";
   next-server 192.168.1.160;
   filename "linux-install/pxelinux.0";
}
      # we want the nameserver to appear at a fixed address
      host ns {
            next-server marvin.redhat.com;
            hardware ethernet 12:34:56:78:AB:CD;
            fixed-address 207.175.42.254;
      }
}

:wq!

Here next server IP should be your tftp IP. In this example all services (tftp, NFS, DHCP,PXE) are in a single node. So that you can give your PXE server IP itself

Start DHCPD service

# service dhcpd restart

Step : 5 - Download system-config-netboot and other dependency packages

# cd /root/Downloads
Force the install of the above packages:

# rpm -ihv --force --nodeps system-config-netboot-* alchemist-1.0.36-2.el5.i386.rpm

Move part of the installed alchemist package to the correct place for getting system-config-netboot tool through GUI

# mv /usr/lib/python2.4/site-packages/* /usr/lib/python2.6/site-packages/

After installing system-config-netboot you can administrate your PXE server through GUI
To use the graphical version of the Network Booting Tool, you must be running the X Window System, have root privileges, and have the system-config-netboot RPM package installed. To start the Network Booting Tool from the desktop, go to Applications (the main menu on the panel) => System Settings => Server Settings => Network Booting Service. Or, type the command system-config-netboot at a shell prompt (for example, in an XTerm or a GNOME terminal).

If starting the Network Booting Tool for the first time, select Network Install from the First Time Druid. Otherwise, select Configure => Network Installation from the pull down menu, and then click Add. The dialog in Figure 1, “Network Installation Setup” is displayed.


















Figure 1. Network Installation Setup

o    Operating system identifier — Provide a unique name using one word to identify the Red Hat Enterprise                  Linux version and variant. It is used as the directory name in the /tftpboot/linux-install/ directory.
o    Description — Provide a brief description of the Red Hat Enterprise Linux version and variant.
o    Selects protocol for installation — Selects NFS, FTP, or HTTP as the network installation type depending on
       which one was configured previously. If FTP is selected and anonymous FTP is not being used,
       uncheck 
Anonymous FTP and provide a valid username and password combination.
o    Kickstart — Specify the location of the kickstart file. The file can be a URL or a file stored locally (diskette).
o    Server — Provide the IP address or domain name of the NFS, FTP, or HTTP server.(This example you have to                select NFS as we have shared iso image through NFS)
o    Location — Provide the directory shared by the network server. If FTP or HTTP was selected, the directory must be
       relative to the default directory for the FTP server or the document root for the HTTP server. For all network
       installations, the directory provided must contain the 
RedHat/ directory of the installation tree.

After clicking OK, the initrd.img and vmlinuz files necessary to boot the installation program are transfered from images/pxeboot/ in the provided installation tree to /tftpboot/linux-install/<os-identifier>/ on the tftp server (the one you are running the Network Booting Tool on).



Adding PXE Hosts

After configuring the network server, the interface as shown in Figure 2, “Add Hosts” is displayed.
















Figure 2. Add Hosts
The next step is to configure which hosts are allowed to connect to the PXE boot server.
To add hosts, click the New button.


Figure 3. Add a Host

Enter the following information:
o    Hostname or IP Address/Subnet — The IP address, fully qualified hostname, or a subnet of systems that should be allowed to connect to the PXE server for installations.
o    Operating System — The operating system identifier to install on this client. The list is populated from the network install instances created from the Network Installation Dialog.
o    Serial Console — This option allows use of a serial console.
o    Kickstart File — The location of a kickstart file to use.

Ignore the Snapshot name and Ethernet options. They are only used for diskless environments.

Adding a Custom Boot Message

Optionally, modify /tftpboot/linux-install/msgs/boot.msg to use a custom boot message.

From Client:

We should now be ready to try out our PXE boot server! On your test workstation or VM, enable booting off the network (in the case of PXE booting a Virtualbox VM, you must ensure that the network adapter is set to “bridged mode” instead of “NAT”) and fire away. You should first see your PC launch its PXE agent, looking for a DHCP server to tell it where the PXE server is:

If your PXE server is working, within a few seconds you will see your boot menu.















Thank you.

No comments:

Post a Comment