To run your own NFS (Network File System) server, you’ll need to first install Linux on your server. I’d go with
Debian, Ubuntu or CentOS distributions. Once you’ve done that, you can install the NFS server software, which is
typically included with most Linux distributions. After the NFS server software is installed, you’ll need to configure
it to specify which directories on the server should be shared with NFS clients, and what type of access they should
have. This typically involves editing the server’s configuration file, which is typically located at
Once the server is configured, you can start the NFS server and begin sharing files with NFS clients. To access the
shared files, the NFS clients will need to mount the NFS share using the mount command.
To set up an NFS server and two clients, you’ll need to follow these steps:
- Create three VM guests on your laptop or desktop. Use a Linux distribution like Debian or Ubuntu for all the
three VMs. You can mix and match the distributions for extra fun.
- On the NFS server VM, install the NFS server software. Configure the NFS server to share certain directories with NFS
clients. Perhaps share
/var/myapp with the clients.
- On the NFS client VMs, configure the NFS client to mount the NFS share from the server. For manual testing use the
mount command to specify the IP address of the NFS server and the directory that should be mounted. To make the
configuration permanent use
- Test the setup by creating a file on one of the NFS clients and verifying that it is visible on the other client.
This will ensure that the NFS server is correctly sharing files with the clients.
After you have set up the NFS server and clients, you can use them to share files and access them from multiple devices.
You can also use the NFS server’s configuration file to control access to the shared files and to customize other
aspects of the server’s behavior.
Like all our DevOps labs, use IAC tools such as Ansible to orchestrate the NFS server and configure the NFS clients.
Optional Lab Exercise
- Create a web application or use an open source web application that allows file uploads from stores them on the disk
- Install the web application on the NFS client VMs
- For the storage location, ie the path in which the application stores the uploaded files, use NFS
- Test. Ensure that a file uploaded on
clinet-01 shows up on
client-02 as well.