NFS Server and Client on Centos 7

Here is a quick and dirty working example of an NFS Server setup on Centos 7 that allows anonymous connectivity from any host to an exported filesystem and a Client mount from Fedora.  It can be used to assist in troubleshooting problematic NFS mounts.

On Centos Server, Install NFS

Centos server should be able to ping Fedora machine.

yum install nfs-utils

mkdir /var/nfsshare

chmod -R 755 //var/nfsshare

chown nfsnobody:nfsnobody /var/nfsshare

systemctl enable rpcbind
systemctl enable nfs-server
systemctl enable nfs-lock
systemctl enable nfs-idmap
systemctl start rpcbind
systemctl start nfs-server
systemctl start nfs-lock
systemctl start nfs-idmap

vi /etc/exports

/var/nfsshare *(rw,sync,no_root_squash,no_all_squash)

systemctl restart nfs-server

firewall-cmd –permanent –zone=public –add-service=nfs
firewall-cmd –permanent –zone=public –add-service=mountd
firewall-cmd –permanent –zone=public –add-service=rpc-bind
firewall-cmd –reload

On  Fedora Client, Mount NFS Export

fedora machine should be able to ping centos machine.  edit /etc/hosts if you want to use hostnames (and don’t have DNS).

yum install nfs-utils

mkdir -p /mnt/nfs/var/nfsshare

vi /etc/fstab

centos1:/var/nfsshare /mnt/nfs/var/nfsshare nfs defaults 0 0

mount -a

or mount -t nfs centos1:/var/nfsshare /mnt/nfs/var/nfsshare/

Note that all the above steps are necessary to work.  Once this works, modify it one thing at a time and keep retesting the mount until you find what breaks it.



Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.