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
- Make a folder on the sharing server that has oodles of space, I didn’t bother to setup quotas.
- bash# mkdir /raid5_san/shared
- 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 192.168.69.1/255.255.255.255(rw,sync)
- Save
- Edit /etc/hosts.allow
- bash# vi /etc/hosts.allow
- Add this line:
portmap: 192.168.69.1/255.255.255.255
- Save
- Start nfs and portmap
- bash# /etc/init.d /nfs start
- bash# /etc/init.d/portmap start
- 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)
- Start portmap
- bash# /etc/init.d/portmap start
- Mount the nfs folder
- bash# mount 192.168.69.2:/raid5_san/shared /mnt
- Check /var/log/messages for any error that might occur
- bash# tailf /var/log/messages
- Use mount to check if the folder is mounted properly
- bash# mount
- This should be the output:
- 192.168.69.2:/raid5_san/shared on /mnt type nfs (rw,addr=192.168.0.1)
- Edit /etc/fstab to mount the shared folder on boot
- bash# vi /etc/fstab
- Add this line
- 192.168.69.2:/raid5_san/shared /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
Florancet
Great job on this piece! Its both informative and engaging. Im eager to hear your thoughts. Check out my profile!