RHEL/CentOS Diskless Clients
Last modified on:
05-23-2007 - Created.
04-17-2008 - Tweaked for RHEL/CentOS 4.6, added notes about not working with RHEL/CentOS 5
By: MaxHetrick
Currently RHEL/CentOS 5 support for system-config-netboot is not working. There are technical difficulties in the package that don’t allow for ease of use. You can install the FC6 package for system-config-netboot and it will work, but there are many other issues. This guide will assist in trying to get things to play nice in the RHEL/CentOS 5 environment, but I was unsuccessful after following the instructions. Perhaps you’ll have more luck. Red Hat is supposed to fix and include and system-config-netboot in the future, but I’m not sure when. This shouldn’t prevent you from loading RHEL/CentOS 5 machines as the actual diskless clients, it just means you can’t easily use RHEL/CentOS 5 as the NFS Diskless Server.
This guide will help you setup an NFS server to dish out diskless clients on your network. This is useful if you want to bring up workstations quickly, without the hassle of hard drives, and or worrying about multiple installations along the way. Some of the commands are from the official Red Hat Docs. This guide will assume you’re creating two different installation types, a server and a desktop installation.
System:
CentOS 4.6
CentOS 5.1
References:
Official Red Hat Guide
Red Hat NFS Guide
NFS Server Setup
1. Install NFS & Create Directories
The first step is to create a NFS server if one doesn’t already exist. This is where the actual client OS gets stored. When a host with a PXE boot enabled network card boots, it’ll hit up a DHCP server for an IP, and then get its files and configurations from the NFS share configured here. Having a bit of disk space laying around is going to be a must if you start adding installations, because the entire client OS will be copied to the NFS server. Go ahead and install the NFS packages if they aren’t already installed on your server.
# yum install nfs-utils nfs-utils-lib sytem-config-nfs
Next, create the directories that you will be needing later on. These will be the actual NFS shares specified. If you want to put these somewhere else, or you can to specify different names, do so. You can share them from anywhere. The first directory will host a server installation of CentOS4, and the second directory a CentOS installation with a desktop environment.
# mkdir -p /srv/diskless/i386/RHEL4S/root # mkdir -p /srv/diskless/i386/RHEL4D/root
2. Configure NFS Mounts
Now you need to create the actual actual shares and start the NFS server.
# vim /etc/exports /srv/diskless/i386/RHEL4S/root/ *(ro,sync,no_root_squash) /srv/diskless/i386/RHEL4S/snapshot/ *(rw,sync,no_root_squash) /srv/diskless/i386/RHEL4D/root/ *(ro,sync,no_root_squash) /srv/diskless/i386/RHEL4D/snapshot/ *(rw,sync,no_root_squash)
Start the NFS server and verify the NFS shares are ok and start the service. If NFS services are already running, then reload them.
# service nfs start (reload) # chkconfig nfs on # nfs-export -l Directory Permissions Hosts /srv/diskless/i386/RHEL4S/root/ ro * /srv/diskless/i386/RHEL4S/snapshot/ rw * /srv/diskless/i386/RHEL4D/root/ ro * /srv/diskless/i386/RHEL4D/snapshot/ rw *
DHCP Server Configuration
If you don’t already have a Linux DHCP server going on your network, then please see the documentation regarding setup of a DHCP server. It’s completely acceptable to install a DHCP server on the NFS server if you want. For my example, there is a separate DHCP server already running.
1. PXE DHCP Configuration
Place the following configuration within /etc/dhcpd.conf. This specifies that network booting will be allowed. When the DHCP server comes across such a request, it will direct the client to the NFS server you have specified. Please remember or keep in mind that if you already have a DHCP server on the network, be careful with adding a second one.
# vim /etc/dhcpd.conf
allow booting;
allow bootp;
class "pxeclients" {
match if substring(option vendor-class-identifier, 0, 9) = "PXEClient";
next-server 192.168.1.20;
filename "linux-install/pxelinux.0";
}
2. Setup tftp
Ensure that xinetd and tftp are installed on the DHCP server.
# yum install xinetd tftp-server
Ensure both services are setup on the DHCP server.
# chkconfig --level 345 xinetd on # chkconfig --level 345 tftp on
Install/Configure/Copy an Installation
Next you have to actually install an installation, or use an existing system from somewhere. For this experiment, I’ve installed a fresh basic non-gui load of CentOS 4.6. Completely setup the host as you wish, because this will be the actual copy of all the diskless clients in a bit. For my purposes, I’ve installed, updated, and copied any local configurations I want or need on my network to my host. Anything you want customized, do it now because it’s easier to set it up once the right way. A perfect example of this is if you need third-party RPM packages installed, go ahead and install them on the host now. The only package that is required on the host is busybox-anaconda.
# yum install busybox-anaconda
Once you have your installation configured the way you want, go back over to the NFS server and rsync the installation to the NFS share. If you don’t want to see what’s being copied, remove the -v switch.
# rsync -v -a -e ssh --exclude='/proc/*' --exclude='/sys/*' host_of_installation:/ /srv/diskless/i386/RHEL4S/root/ receiving file list... <snip buckets of output>
Diskless Client Setup
1. Netboot Configuration
Head back over to your NFS server now. If you are remotely accessing the server via SSH, then you must forward X with the session.
# ssh -X nfs_server
Install the netboot configuration tool if it’s not already on the system, and launch the tool. There are differences between 4.6 and 5.1 during this step. RHEL 5 does not include system-config-netboot due to technical problems. You can however install the FC6 binary with a little extra work.
# yum install system-config-netboot # system-config-netboot
You should have a nice little X window pop up asking you what you want to do. The first time you run this, you should get the little wizard popup. Click Diskless to continue. The steps are outlined for what you have to do. The rsync step has already been completed. Click Forward and enter an OS name and description. The next screen is where you enter your NFS information. In the Server IP Address, enter the NFS server IP. In the Directory section, enter the first NFS share — /srv/diskless/i386/RHEL4S. On the next screen, pick the kernel that you want running on your diskless clients. When complete, click Apply and wait a few moments as it does its magic. This tool automatically creates and configures an image file and places it in the PXE boot directory.
2. Host Configuration
Once the diskless OS environment is setup, you can create and configure a new host system with the configuration tool. If you need specifics of what all the parameters are, then check out the adding hosts section of Red Hat’s documenation. In the GUI tool, select New to start the host creation process.
The machine you’re adding must have a valid IP or hostname on the network, which shouldn’t be an issue. For my instance, I took an existing PC off my network, pulled the hard drive, and used it to boot diskless. In the hostname field, go ahead and enter a valid machine. Since you only have one OS environment setup at the moment, the only option for OS will be the one you just created in step 1 of the netboot configuration. If you have more than one OS, then choose the appropriate OS you desire in the drop-down menu. If you leave the snapshot name blank, then it will automatically fill it in with the hostname it finds on your network. Remember we exported an NFS mount point for this: /srv/diskless/i386/RHEL4S{D}/snapshot. Lastly, if you want the host to log remotely, then fill in your system logger that accepts remote logging. When finished, click ok to create the host.
If you don’t want to have to deal with the wrong hostname on any new machine, then go ahead and wipe it out of the synced files. For instance, I’m creating a server install because I want to have it as generic as possible, and I also want to have it boot on multiple machines. If I leave the information in the files, then it’ll pick up the hostname of the machine the OS was created on. It’s a minor annoyance. If you don’t care, leave it alone.
# vim /srv/diskless/i386/RHEL4S/root/etc/sysconfig/network-scripts/ifcfg-eth0{1,2,3} (whatever your NIC is)
HWADDR= <--- blank this out
DHCPDHCP_HOSTNAME= <-- blank this out
Now when you boot up the new diskless host, it won’t get mad about the MAC address being different, and it won’t have a hostname. It should only be named localhost. Obviously you can set the hostname at will.
That’s it for adding hosts. You can now repeat this entire process for each OS environment type. Don’t forget if you create a new OS type, then you’re going to want to add a new directory under NFS to export. Think of it as housing different OSes, so make the names distinguishable. For my uses, I’m creating the already mentioned server and desktop installation. You can use it for anything you want, though. Let’s say you want to create an instance for a very specific task, but don’t have a hard drive for the machine. This allows you to create an instance on VMware, or any other virtual environment, and copy that installation over to NFS. Now you can boot it up on any machine with a PXE network card.
PXE Boot
A note about PXE, which is short for Preboot Execution Environment. Do a Wikipedia search if you really desire deeping meanings. In short, the network card’s firmware searches for a PXE redirect, which happily passes this information along from the DHCP server, which then points it to your NFS server specified. It then downloads via tftp the boot file path into memory, and continues to execute it. Ultimately, you have your OS boot up from memory then.
All network cards are different, so consult the manufacturer of the card for information on enabling PXE on your system. Most new cards support it right out of the box, and it’s just a matter of turning it on in the BIOS (on board NICs), or by accessing a utility menu from the network card. Again, all cards are different.
Once you have the NIC and system ready to go, fire it up and test it out. You should have it boot to the NIC menu, it might say something about the MAC address, or about bootp loading. It should immediately get passed on to your NFS server, and then boot the Linux image. Now you can go steal all of those hard drives out of your PCs at work, huh.





