Showing posts with label nfs. Show all posts
Showing posts with label nfs. Show all posts

Monday, April 18, 2016

How to Setup NFS share in Linux

NFS or Network File System is a very convenient way of allowing the data on one Linux host to be accessible on another. The procedure for setting up a NFS share and accessing the same on a client is very simple.

Step 1: Install the nfs utilities and rpcbind (portmap) on the source host.

]# yum install nfs-utils nfs-utils-lib

Step 2: Create a file /etc/exports and enter the following information.

/tmp *(rw,sync,no_root_squash)

In the line above:

/tmp           - The folder to be shared
*              - Allow access to all clients
rw             - Provide read/write access
sync           - The requests are honored only after changes are committed
no_root_squash - Allow root user to access the share

Step 3: Make sure nfs and rpcbind services start at boot. Export the list of shared folders and start these services now.

]# chkconfig rpcbind on
]# chkconfig nfs on

]# exportfs -rv

]# service rpcbind restart
]# service nfs restart

Step 4: To see the list of nfs exports, run:

]# showmount -e localhost

To see the same list from a different host, run:

]# showmount -e <ip address/hostname>

Step 5: Mount and access the contents:

]# mount -t nfs <ipaddress/hostname>:/tmp /mnt/share