*nix Admin Stuff

Setting up an NFS Share on CentOS 5

I had the “pleasure” of setting up an NFS share today on CentOS 5 for the first time. It was actually surprisingly easy to accomplish:

Configure the Server

  1. Make a folder on the sharing server that has oodles of space, I didn’t bother to setup quotas.
    • bash# mkdir /raid5_san/shared
  2. Edit /etc/exports, insert the ip addresses of any machines that will need to access the share like this:
    • bash# vi /etc/exports
    • Add in: /raid5_san/shared,sync)
    • Save
  3. Edit /etc/hosts.allow
    • bash# vi /etc/hosts.allow
    • Add this line:
    • portmap:
    • Save
  4. Start nfs and portmap
    • bash# /etc/init.d /nfs start
    • bash# /etc/init.d/portmap start
  5. Make sure that portmap and nfs are set to autostart. You can set this by running /usr/sbin/ntsysv (assuming default scripts are already there in /etc/init.d).

Configure the Client(s)

  1. Start portmap
    • bash# /etc/init.d/portmap start
  2. Mount the nfs folder
    • bash# mount /mnt
  3. Check /var/log/messages for any error that might occur
    • bash# tailf /var/log/messages
  4. Use mount to check if the folder is mounted properly
    • bash# mount
    • This should be the output:
    • on /mnt type nfs (rw,addr=
  5. Edit /etc/fstab to mount the shared folder on boot
    • bash# vi /etc/fstab
    • Add this line
    • /mnt nfs rw,hard,intr 0 0
    • Save

You can use ‘man exports’ to see the options available for /etc/exports

Thanks to linuxwave, I tweaked their instructions a bit.

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *