Setup an NFSv3 Server on CentOS 6

You can convert a plain CentOS machine into an NFSv3 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 setup.

Step 1 – Download and Install the Required NFS Software

Start by downloading and installing the required NFS packages on both the NFS server and the client.

[bash]yum -y install nfs-utils nfs-utils-lib [/bash]

Start the appropriate NFS services on the server.

[bash]chkconfig nfs on
service rpcbind start
service nfs start
service nfslock start[/bash]

Start the rpcbind service on the client.

[bash]service rpcbind start[/bash]

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:

[bash]vi /etc/exports[/bash]

Add the following line to the file:


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

  • rw: This option allows the client server to both read and write within the shared directory
  • sync: Sync confirms requests to the shared directory only once the changes have been committed.
  • no_subtree_check: This option prevents the subtree checking. When a shared directory is the subdirectory of a larger filesystem, nfs performs scans of every directory above it, in order to verify its permissions and details. Disabling the subtree check may increase the reliability of NFS, but reduce security.
  • no_root_squash: This phrase allows root to connect to the designated directory
  • insecure: The default NFS setting is “secure” which requires that requests originate on an Internet port less than IPPORT_RESERVED (1024). To turn this setting off, specify insecure.

(NOTE: depending on your use case, either all or some of these options will make sense. For more information please reference NFS documentation.)

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

Once that’s done, export the directories:

[bash]exportfs -a[/bash]

Step 3 – Mount the exported directory

Mount the exported directory on /mnt.

[bash]mount -o vers=3 :/foo /mnt[/bash]

The browser you are using is outdated. For the best experience please download or update your browser to one of the following: