Linux, FreeBSD, Juniper, Cisco / Network security articles and troubleshooting guides

FAQ
It is currently Sun Aug 20, 2017 4:45 am


Guides and tutorials for Red Hat Linux, Debian, Suse and others.

Author Message
LaR3
  Post  Post subject: Installing /w PXE booting RHEL 5 over the network  |  Posted: Wed Aug 05, 2009 7:00 am

Joined: Mon Aug 03, 2009 4:55 pm
Posts: 19

Offline
 

Installing /w PXE booting RHEL 5 over the network

Installing and PXE booting RHEL 5 over the network

In the past weeks I needed to install Red Hat Enterprise 5 on two remote HP DL385 blades (if I remember correctly) and I had no one in the datacenter to insert the DVD in the drives. So the situation needed a network installation using PXE booting (Pre-boog eXecution Environment).

Since this was my first encounter with PXE booting and network installations on Linux Google was my friend.

I will describe the procedure in my test environment as it is more convenient to me. Here are the requirements:
0) MAC address of the NIC from the machine that will be installed from the network (in my test environment a VirtualBox machine on my Debian Lenny Desktop) - not so difficult to aquire.
1) DHCP server (my FreeBSD 6.4 gateway).
2) TFTP server (same machine as DHCP server, running from inetd).
3) syslinux package (downloaded from http://www.kernel.org/pub/linux/utils/boot/syslinux/syslinux-3.81.tar.bz2).
5) NFS server (or you can use FTP/HTTP protocols also)
6) A Red Hat Enterprise 5 DVD (more precise, it's contents).
7) A machine with PXE booting capabilities (the network interface has to have this option) - in my case VirtualBOX machine.

Configuring the DHCP server (isc-dhcp30-server-3.0 with PXE extension):
Here's my *host* part from the dhcp server's config file referring strictly virtual machine:
Code:
host vbox-rhel5 {
  hardware ethernet 08:00:27:F2:63:E2;   #MAC address
  fixed-address 192.168.1.61;  #IP
  server-name "vbox-rhel5"; #HOSTNAME
  filename "pxelinux.0"; #file that DHCP server will tell to the VBOX machine to load.
}

Save the file and quit. Next, restart the DHCP server:
Code:
# /usr/local/etc/rc.d/isc-dhcpd restart
Stopping dhcpd.
Starting dhcpd.

Configuring and preparing the TFTP server
As I mentioned above, the TFTP server will be running from inetd. So uncomment the appropriate line in /etc/inetd.conf:
Code:
# grep tftp /etc/inetd.conf
tftp   dgram   udp   wait   root   /usr/libexec/tftpd   tftpd -l -s /storage/export #[color=#80FF00] This directory will be the root directory of the tftp server[/color]
#tftp   dgram   udp6   wait   root   /usr/libexec/tftpd   tftpd -l -s /tftpboot #[color=#FF4000]THIS I DON'T NEED[/color]

# /etc/rc.d/inetd restart
Stopping inetd.
Starting inetd.

Now download the syslinux and untar it:
Code:
# cd /tmp
# fetch http://www.kernel.org/pub/linux/utils/boot/syslinux/syslinux-3.81.tar.bz2
syslinux-3.81.tar.bz2                         100% of 3011 kB  585 kBps
# tar jxf syslinux-3.81.tar.bz2
# find syslinux-3.81 -name pxelinux.0
syslinux-3.81/core/pxelinux.0
# cp syslinux-3.81/core/pxelinux.0 /storage/export/

So we have the pxelinux loader in the root directory of the TFTP server, but we also need an init ram disk and the kernel to be loaded by the pxeloader. These can be found on the RHEL5 DVD in /images/pxeboot/ directory.
Code:
# mkdir /storage/export/RHEL5
# mdconfig -a -t vnode -f /iso/RHEL-server-5.3-x86_dvd/rhel-server-5.3-i386-dvd.iso -u 0 #this creates a memory disk from the iso image
# mount -t cd9660 /dev/md0 /storage/export/RHEL5

I mounted the ISO image in /storage/export/RHEL5 because later I will use this directory to mount it via NFS from the FreeBSD server to the virtual machine and use it as installation media.

Copy the initrd.img and vmlinuz from /storage/export/RHEL5/images/pxeboot/ to the root of the TFTP server:
Code:
# cp /storage/export/RHEL5/images/pxeboot/initrd.img /storage/export/
# cp /storage/export/RHEL5/images/pxeboot/vmlinuz /storage/export/

Create a default PXE boot configuration:
Code:
# mkdir /storage/export/pxelinux.cfg
# vim /storage/export/pxelinux.cfg/default
default linux
timeout 100

label linux
kernel vmlinuz
append initrd=initrd.img ramdisk_size=9216 noapic acpi=off


Configure NFS server on the FreeBSD gateway
edit /etc/exports file and add below line at the end
Code:
# vim /etc/exports
....
/storage/export/RHEL5 -alldirs -maproot=root -ro 192.168.1.61 #add this line at the end of the file
# killall -HUP mountd
# showmount -e
/storage/export/RHEL5          192.168.1.61


Before I attempted to boot the virtual machine, I needed to make sure that, on the NFS/TFTP/DHCP server everything in /storage/export is readable (chmod -R 755 /storage/export).

Code:
Searching for server...
...
Loading 192.168.1.254:pxelinux.0................(PXE)............
...
Loading vmlinuz....
Loading initrd.img...


Next, the Languge & keyboard prompts appear and then the Installation Method screen. Choose NFS image and select IPv4.
In the NFS server name: 192.168.1.254 (The IP address of the FreeBSD server)
Red Hat Enterprise Linux Server directory: /storage/export/RHEL5

Press Enter and next, the Anaconda X based installer starts. From here on, it's a normal RHEL installation.

Please post your feedbacks.

_________________
Humble user
http://www.ivorde.ro





Top
Display posts from previous:  Sort by  
E-mail friendPrint view
Who is online
Users browsing this forum: No registered users and 0 guests
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum
Jump to:  
cronNews News Site map Site map SitemapIndex SitemapIndex RSS Feed RSS Feed Channel list Channel list


Delete all board cookies | The team | All times are UTC - 5 hours [ DST ]



phpBB SEO