Configuring NFS Server and Client
Configurating NFS Server
Installing NFS Server
server(192.168.0.1) $ sudo apt install nfs-kernel-server
server(192.168.0.1) $ sudo mkdir /var/nfs/general -p
server(192.168.0.1) $ sudo chown nobody:nogroup /var/nfs/general
server(192.168.0.1) $ sudo vi /etc/exports
Configuring NFS exports in /etc/exports
Allowing accesses based on CIDR block
This method allows access from all IP addresses from 192.168.0.1 to 192.168.0.255.
/var/nfs/general 192.168.0.0/24(rw,sync,no_subtree_check)
Allowing accesses based on the hostname
/var/nfs/general 192.168.0.2(rw,sync,no_subtree_check)
Once /etc/exports
is configured, please restart NFS server.
server(12.34.56.78) $ sudo systemctl restart nfs-kernel-server
Configuring NFS Client and Mount
client(192.168.0.2) $ sudo apt install nfs-common
client(192.168.0.2) $ sudo mkdir /mnt/nfs
client(192.168.0.2) $ sudo mount 192.168.0.1:/var/nfs/general /mnt/nfs
If you don't install nfs-common
, you will get error messages like below
mount: /mnt/nfs: bad option;
for several filesystems (e.g. nfs, cifs) you might need a /sbin/mount.<type> helper program.
Configuring NFS for Sync API using Coordinator
nfs.conf
format
{
"serverAddress": "<SERVER ADDRESS>:<NFS PATH>",
"mountPath": "<LOCAL MOUNT PATH>",
"syncPath": "<LOCAL MOUNT PATH>/<SYNC COUNTER PATH>"
}
Example
{
"serverAddress": "192.168.0.1:/var/nfs/general",
"mountPath": "/mnt/iob_mount",
"syncPath": "/mnt/iob_mount/sync"
}
Make nfs.conf
using Coordinator
coordinator # shell hosts 'apt install nfs-common'
coordinator # shell hosts 'echo { \"serverAddress\": \"192.168.0.1:/var/nfs/general\", \"mountPath\": \"/mnt/iob_mount\", \"syncPath\": \"/mnt/iob_mount/sync\" } > /etc/qam/nfs.conf'