NFS quick howto for centos 5
To use nfs successfully, you have to configure the server and the client. In this example, the client is 192.168.0.3 and the server is 192.168.0.1. The folder to be shared is /home/sharing, and to be mounted to /mnt on the client
On the server
- Make directory that you want to use.
- # mkdir /home/sharing
- Edit /etc/exports, insert the client machine's ip
- # vi /etc/exports
- Add this line:
- /home/sharing 192.168.0.3/255.255.255.255(rw,sync)
- Save
- Edit /etc/hosts.allow
- # vi /etc/hosts.allow
- Add this line:
- portmap: 192.168.0.0/255.255.255.0
- Save
- Start nfs and portmap
- # /etc/init.d /nfs start
- # /etc/init.d/portmap start
On the client
- Start portmap
- # /etc/init.d/portmap start
- Mount the nfs folder
- # mount 192.168.0.1:/home/sharing /mnt
- Check /var/log/messages for any error that might occur
- # tailf /var/log/messages
- Use mount to check if the folder is mounted properly
- # mount
- This should be the output:
- 192.168.0.1:/home/sharing on /mnt type nfs (rw,addr=192.168.0.1)
- Edit /etc/fstab to mount the shared folder on boot
- # vi /etc/fstab
- Add this line
- 192.168.0.1:/mnt/sdb1/backup /mnt nfs rw,hard,intr 0 0
- Save
You can use 'man exports' to see the options available for /etc/exports