Home > Linux > NFS Quick howto for CentOS 5

NFS Quick howto for CentOS 5

April 14, 2011

To use NFS successfully, you’ll have to configure the server and the client. In this example, the client is 192.168.10.5 and the server is 192.168.10.1. The folder to be shared is /home/sharing, and to be mounted to /mnt on the client.

On the server:

1. Make directory that you want to use.
# mkdir /home/sharing

2. Edit /etc/exports, insert the client machine’s ip
# nano /etc/exports
Add this line:
/home/sharing 192.168.10.5/255.255.255.0(rw,sync)
Save.

3. Edit /etc/hosts.allow
# nano /etc/hosts.allow
Add this line:
portmap: 192.168.10.0/255.255.255.0
Save.

4. Start NFS and portmap
# /etc/init.d/nfs start
# /etc/init.d/portmap start

 

On the client:

1. Start portmap
# /etc/init.d/portmap start

2. Mount the nfs folder
# mount 192.168.10.1:/home/sharing /mnt

3. chech /var/log/messages for any error that might occur
# colortail -f /var/log/messages

4. Use mount to chech if the folder is mounted properly
# mount
The output should be like this:
192.168.10.1:/home/sharing on /mnt type nfs (rw,addr=192.168.10.1)

5. Edit /etc/fstab to mount the shared folder on boot
# nano /etc/fstab
Add this line:
192.168.10.1:/home/sharing /mnt nfs rw,hard,intr 0 0
Save.

 

 

Tags: ,
%d bloggers like this: