Create an NFS Mount on CentOS 7

This article will demonstrate how to create an NFS mount on a CentOS 7 box.  This can be useful for: sharing documents, sharing ISOs to ESXi hosts (mount as a datastore), dumping backups, etc.


Let’s create a simple NFS mount on CentOS 7.  For this example, this mount will be accessible to everyone.  We’ll start off by creating a directory for our shared data.

mkdir /data/Documents
chmod -R 777 /data/Documents

While we’re on the server, we also need to install nfs-utils (if not already installed), enable the NFS server service, and start the NFS server service.  Enabling the NFS server service will make sure that upon reboot, the NFS server service is running.

yum install -y nfs-utils
systemctl enable nfs-server
systemctl start nfs-server

Now that the NFS server is running, we need to tell it what directories to share.

echo "/data/Documents *(rw,sync,nohide)" > /etc/exports

And last but not least, we’ll signal the NFS server to parse /etc/exports and start sharing our new directory (without restarting or disrupting the service).

exportfs -a


First, let's make sure that nfs-utils has been installed:

yum install -y nfs-utils

After, you can confirm that the NFS mount is now available by running:

Client:~ user$ showmount -e
Exports list on
/data/Documents *

Finally, you can mount the share by running:

mkdir -p /mnt/NFS/Documents
mount -t nfs /mnt/NFS/Documents/