Tutorial: How to set up an NFS Server on CentOS

You can convert a plain CentOS machine into an NFS server by installing the NFS Linux packages and configuring access to the shared directories. Here's a simple step-by-step guide to help you get this set up.

Step 1 - Download and Install the Required NFS Software

Start by downloading and installing the required NFS packages.

yum -y install nfs-utils nfs-utils-lib 

Start the appropriate NFS services.

chkconfig nfs on
service rpcbind start
service nfs start

Step 2 - Export Appropriate Shared Directories

Next step is to export appropriate directories on your NFS server so that they are accessible via NFS clients. You do this by adding the appropriate directory to /etc/exports file, which specifies both the directory to be shared and the details of how it is shared.

Edit the /etc/exports file:

vi /etc/exports

Add the following line to the file:


where /foo is the directory you are trying to export.

Add entries to the /etc/exports file for each directory you wish to export.

Once that's done, export the directories:

exportfs -a


October 14, 2015