Install NFS on CentOS 7

  • Install NFS Server. Server and client install same pacakge nfs-utils.
    sudo yum install nfs-utils
  • Create shared folder
    mkdir /var/nfsshare
    mod -R 755 /var/nfsshare
    chown nfsnobody:nfsnobody /var/nfsshare
  • Add share folder in /etc/exports
  • Enable and start NFS server
    sudo systemctl enable rpcbind
    sudo systemctl enable nfs-server
    sudo systemctl enable nfs-lock
    sudo systemctl enable nfs-idmap
    sudo systemctl start rpcbind
    sudo systemctl start nfs-server
    sudo systemctl start nfs-lock
    sudo systemctl start nfs-idmap
  • Setup firewall if it is enabled
    sudo firewall-cmd --permanent --zone=public --add-service=nfs
    sudo firewall-cmd --permanent --zone=public --add-service=mountd
    sudo firewall-cmd --permanent --zone=public --add-service=rpc-bind
    sudo firewall-cmd --reload
  • Mount nfs folder on Client
    mkdir -p /mnt/nfs/var/nfsshare
    sudo mount -t nfs /mnt/nfs/var/nfsshare/
  • Permanent NFS mounting by editing /etc/fstab.    /mnt/nfs/var/nfsshare   nfs defaults 0 0


Written on March 5, 2019