Sharing data across multiple computers can be achieved in many different ways, in this blog post I’m going to use an Network File System (NFS) share.
Server
The server will require nfs-kernel-server installing and at least one share setting up:
apt install nfs-kernel-server
I’m going to be using the share to share out a basic HTML page via nginx, so I’m going to call the directory nginx:
mkdir /var/nfs/nginx -p
Note: In a production environment make sure to set appropriate permissions on the directory.
nfs-kernel-server has configuration under /etc/exports, which will need editing to with the details of the clients that will be connecting:
nano /etc/exports
The exports file has the format of:
/path/to/sharedfolder ClientIPADDRESS(permissions, options)
Once the configuration has been edited, nfs-kernel-server will need restarting:
systemctl restart nfs-kernel-server
Clients
The clients will require nfs-common installing:
apt install nfs-common
The clients will need a directory to map the share to:
mkdir -p /nfs/nginx
And then will need to mount the share into the directory:
mount SERVERIPORHOSTNAME:/var/nfs/nginx /nfs/nginx
If you have multiple clients I would recommend some Ansible here to do the heavy lifting.