Install and configure NFS server
Overview
NFS (Network File System) protocol allows you to share the data in your network.
Disable firewall
sudo systemctl disable ufw
sudo systemctl stop ufw
sudo systemctl status ufw
Apply default iptables
configuration.
timedatectl
sudo timedatectl set-timezone Europe/Madrid
date
Server side
sudo apt update
sudo apt install -y nfs-kernel-server
Create NFS export directory
sudo mkdir /data
sudo chown nobody:nogroup /data
sudo chmod 777 /data
Grand NFS access to a client
man 5 exports
/etc/exports
/data IP(rw,sync,no_subtree_check)
# for k8s
/data IP(rw,sync,no_subtree_check,no_root_squash)
Export NFS share directory
sudo exportfs -a
Check.
sudo systemctl restart nfs-kernel-server
sudo systemctl status nfs-kernel-server
Install NFS client (client side)
sudo apt update
sudo apt install -y nfs-common
Create NFS mount point (client side)
sudo mkdir /data/nfs-share
sudo mount NFS-Server-IP:/data /data/nfs-share
sudo mount 192.168.56.20:/data /data/nfs-share
Testing (server side).
sudo touch file{1,2,3} /data
ls /data