28 December 2010

Creating an NFS Installation Server - RHCE

In the following steps, you'll learn how to create a shared directory, copy the Red Hat installation files, and then set up the share through NFS. As NFS is the most efficient way to share files between Linux and Unix computers, I suspect it's the most likely option for network installations during the exam. You'll need the Red Hat Enterprise Linux installation CDs, or at least the ISO files associated with those CDs.
  1. Create a directory for your installation files. With the following command, create the /inst directory:
    # mkdir /inst
  2. Insert the first Red Hat Enterprise Linux installation CD/DVD into its drive. If you're running the default GNOME desktop, it'll get mounted automatically, using the name of the media; for example, my first RHEL installation CD is automounted in the /media/RHEL-5 i386 Disc 1 directory (including all of those spaces). Otherwise, you can mount the CD with a command such as mount /dev/cdrom /media. (If all you have are the ISO files, say in the /tmp directory, substitute mount -ro loop /tmp/firstcd.iso /media.)

  3. Copy the required files from the first Red Hat Enterprise Linux installation CD. Use the cp -ar /source/. /inst command, where source is the mount directory (such as /media/RHEL 5 i386 Disc 1). Don't forget the dot (.); it copies hidden files, including the .discinfo file from the first Red Hat Enterprise Linux installation CD.

  4. Unmount the first Red Hat Enterprise Linux installation CD. If it's an installation DVD, skip to step 6. Use the umount /source command.

  5. Repeat steps 2, 3, and 4 with the remaining Red Hat Enterprise Linux installation CDs.

  6. Set up an NFS share. Add the following line to /etc/exports. You can do it with a text editor such as vi or the system-config-nfs utility (also known as the NFS Server Configuration tool).
    /inst       *(ro,sync)
  7. Export the shared directory.
    # exportfs -a
  8. Make sure there's nothing blocking access to NFS. The default Red Hat Enterprise Linux firewall blocks access to an NFS server. While inelegant, the following command "flushes," or turns off, the standard Linux firewall from the local computer. If you've enabled SELinux, you'll also have to use the SELinux Management Tool to change the associated NFS boolean variable to "Allow the reading on any NFS file system". Don't forget to restart NFS to activate all of your changes.


    On the Job 
    As of this writing, if SELinux is disabled, RHEL 5 won't let you open the SELinux Management Tool. For the latest information, see bug 232544 at http://bugzilla.redhat.com.
    # iptables -F
  9. Now you can activate the NFS service. The following commands assume that it's already running (which you can check using the service nfs status command):
    # service nfs stop
    # service nfs start
  10. Finally, you can check the status of your share. If it's working, you should see the contents of the /etc/exports directory when you run the following command:
    # showmount -e
When you install Red Hat Enterprise Linux from an NFS server, you'll need the name of the installation directory-in this case, /inst.


On the Job 
For an NFS connection, you don't need to copy the files from a CD. If you've downloaded ISOs of the RHEL (or rebuild) installation DVD/CDs, all you need to do is copy them to the shared NFS directory-in this case, /inst. However, this does not work for FTP or HTTP servers, and you won't be able to use the share as an installation source for individual packages.


biOos

No comments: