It’s easy and straightforward. This post shows how to share a nfs mount point across the network.
On the server and client: ensure the following packages are installed: nfs-utils, nfs-utils-lib and portmap.
Server setup:
1. edit the exports file
vim /etc/exports
2. add the following line to the exports file. ( note: this step assumes that you have a directory /buckets and you want to allow everyone in the network be able to connect and use. The /buckets directory is owned by “nobody” user. )
/buckets *(rw,sync,no_root_squash,no_subtree_check,fsid=0)
3. run exportfs and mount the mount points
exportfs -ar
3. start the services portmap and nfs.
service start portmap; service start nfs
4. verify the exports, by running exportfs in verbose mode
exportfs -v
Client Setup:
1. start portmap service
service start portmap
2. mount the nfs share. ( optional: add to /etc/fstab entry )
mount -t nfs4 ip_addr_of_nfs_server:/ ./test/
Firewall setup:
Ensure that TCP Ports: 111 and 2049., UDP Ports: 111 and 2049 are open between the NFS server and client(s).
In case of Amazon EC2, this can be configured in “EC2 SecurityGroups”. For simple cases, assuming all the instances are under the same security group, the source should be same as the security group under which all the instances run. And within instances, the private IP/DNS entry of the instances can be used to access the NFS server.