CentOS 7 - NFS

NFS Server:

Install nfs and configure (data will be available under example user):

# yum -y install nfs-utils rpcbind

# systemctl start rpcbind && systemctl start nfs-server && systemctl start nfs-lock && systemctl start nfs-idmap
# systemctl status rpcbind && systemctl status nfs-server && systemctl status nfs-lock && systemctl status nfs-idmap
# systemctl enable rpcbind && systemctl enable nfs-server && systemctl enable nfs-lock && systemctl enable nfs-idmap

# systemctl status nfs

# mkdir /data
# chown example.example -R /data

# vim /etc/exports

/data  192.168.1.0/24(rw,sync,no_subtree_check,fsid=0)

# exportfs -r

# systemctl restart nfs-server

# firewall-cmd --add-service=nfs --zone=internal --permanent
# firewall-cmd --add-service=mountd --zone=internal --permanent
# firewall-cmd --add-service=rpc-bind --zone=internal --permanent
# firewall-cmd --reload

Client

Make sure example user has the same uid

Install nfs and configure:

# yum -y install nfs-utils

# mkdir /home/nfs_share
# chown -R example.example /home/nfs_share

# mount -t nfs 192.168.1.1:/data /home/nfs_share

# vim /etc/fstab

192.168.1.1:/data   /home/nfs_share nfs defaults 0  0

Check creating file under example user:

$ echo "abcd" > /home/nfs_share/test.txt
$ ls -la /home/nfs_share
$ rm /home/nfs_share/test.txt