NFS stands for Network File System and allows you to mount a file system from 1 host to another. In this case, we will be mounting a directory from a server to several webservers in order to have the site files mirrored on all of the servers or virtual machines.
A minimum of 1 server or virtual machine is necessary to setup shared storage.
Configuring NFS Master
Deploy a VM in our cloud service and then follow these steps to install and configure NFS.
Execute the following command as root to install NFS on your server if it isn't already.
Now enable and start the NFS service.
Create a directory that you want to share with the other servers or VMs.
Edit the exports file to allow your IPs access to the shared mount directory:
The example above is just for illustrative purposes. It follows this pattern:
mountpoint IP-address-to-be-permitted-access (mounting-options-for-that-IP)
You should check man exports on your NFS server to see the variety of options for setting up your /etc/exports file.
Export the filesystem.
Add the IPs that will be accessing NFS to the firewall (the following commands assume you are using firewalld.
Configuring NFS Clients
Now that you have the NFS mounts prepared, you need to install NFS on all of the servers that will need to access the mounts.
Mount the home folder.
- Repeat this on any other servers that need access.