Name File Sharing (NFS)

A Linux server can be configured to serve as a network drive to store and retrieve name recordings from a shared location on a Network File System (NFS). In this guide, the host of the shared files is referred to as the server, and all other machines are referred to as clients.

You can use this guide as a reference when configuring the server or any clients which will access it.

Important

Users who will access the NFS must have the same UID on all machines in the NFS solution. This applies to the server and all clients.

Step 1. Configure the server

  • Install the required dependency packages. These packages will allow you to install an NFS to share across all Linux machines.
yum -y install nfs-utils keyutils-libs libmount libnfsidmap quota rpcbind tcp_wrappers-libs
  • Execute the following commands to start the necessary services and make them restart when the server reboots:
systemctl enable --now rpcbindsystemctl enable --now nfs-server
  • Add an entry to the /etc/exports file to designate the directory to share. See the following example for details.
<LocationToShare> <ClientIPAddress>(rw,sync,no_root_squash,no_subtree_check)
<LocationToShare> (rw,sync,all_squash,anonuid={{enter id here}},no_subtree_check

Example

The following example shows how the /etc/exports file can be updated to designate the directory to share.

/usr/local/namefiles 10.10.0.42(rw,sync,no_root_squash,no_subtree_check)
  • /usr/local/namefiles – Indicates the name of the folder to be shared
  • 10.10.0.42 – Indicates the IP address of the client with which to share. You can use an asterisk (*) instead of an IP address to share with any client.
  • rw - Provides read and write access to the folder from the given IP address.
  • Run the following command to enable the folder:
exportfs -a

Step 2. Configure the clients

Use these instructions to configure any clients that will share the designated NFS directory.

  • Run the following command to install the required dependency packages:
yum -y install nfs-utils keyutils-libs libmount libnfsidmap quota rpcbind tcp_wrappers-libs
  • Mount the NFS folder from the server onto a folder on the client by running the following command:
mount <ServerIPAddress>:<NameFilesFolderPath> <LocalFolderPath>

Example

Consider the following example:

  • Server IP address: 10.10.0.30
  • Server NFS directory location: /var/lib/namefiles
  • Client mount location: /usr/local/tomcat7/webapps/ROOT/namefiles

With these details, the following command would mount the shared NFS folder onto the client:

mount 10.10.0.30:/var/lib/namefiles  /usr/local/tomcat7/webapps/ROOT/namefiles
  • Add an entry to the /etc/fstab file to instruct the OS to mount the folder after every reboot:
<ServerIPAddress>:<NameFilesFolderPath> <LocalFilePath> nfs auto,noatime,nolock,bg,nfsvers=3,intr,tcp,actimeo=1800 0 0
  • Reboot the operating system, then run the following command to mount the file systems in the fstab file.
mount -a

Configuration example

The following example shows how a real-world server and client may be configured.

In our example, there are three computers with Tomcat and IVG installed:

  • IVG01
  • IVG02
  • IVG03

A fourth computer does not have IVG installed:

  • SERVER1

Given the preceding information, you have two options to enable file sharing:

  • Designate one of the Tomcat/IVG machines as the server, then designate the other two Tomcat/IVG machines as clients.
  • Designate SERVER1 (without Tomcat or IVG) as the server, then designate all three Tomcat/IVG machines as clients.

Select the appropriate tab for information on each of these options.

Option 1: Use an IVG machine as the server

  • Perform Steps 1-2 from the server configuration section of this guide to install NFS utilities and start the services.
  • Use the following command on one of the IVG machines to designate a folder to share with the clients:
/usr/local/tomcat7/webapps/ROOT/namefiles *(rw,sync,no_root_squash,no_subtree_check)
  • Enable the NFS folder by running the exportfs command:
exportfs -a
  • Configure the remaining IVG machines as clients by following the client configuration section of this guide.

Option 2: Use SERVER1 as the server

  • Perform Steps 1-2 from the server configuration section of this guide to install NFS utilities and start the services.
  • Since SERVER1 does not have Tomcat installed, any folder can be selected as the NFS shared folder. Use the following command to designate a folder to share with the clients. In this example we are sharing the /var/lib/namefiles directory:
/var/lib/namefiles 10.10.0.42(rw,sync,no_root_squash,no_subtree_check)
  • Enable the folder by running the command:
exportfs -a
  • Configure IVG01, IVG02, and IVG03 as clients by following the client configuration section of this guide.

Important

In either scenario, if the NFS server is down, then the clients will not be able to access the shared name recording files. If this happens, callers may hear "valued customer" rather than their name recordings.

Considerations for firewalls

You may find it necessary to create local firewall rules to allow the necessary services to communicate between the server and client machines. The following commands should accomplish this task:

firewall-cmd --permanent --add-service nfsfirewall-cmd --permanent --add-service mountdfirewall-cmd --permanent --add-service rpc-bindfirewall-cmd --reload

The default ports for the affected services are as follows:

nfs: 2049/tcprpc-bind: 111/tcprpc-bind: 111/udpmountd: 20048/tcpmountd: 20048/udp