NFS stands for Network File System, helps you to share files and folders between Linux / Unix systems, developed by SUN Microsystems in 1984. NFS enables you to mount a remote share locally.
NFS version 4.2 (RFC 7862) was published in November 2016 with new features including: server-side clone and copy, application I/O advise, sparse files, space reservation, application data block (ADB), labeled NFS with sec_label that accommodates any MAC security system, and two new operations for pNFS (LAYOUTERROR and LAYOUTSTATS).
One big advantage of NFSv4 over its predecessors is that only one UDP or TCP port, 2049, is used to run the service, which simplifies using the protocol across firewalls.
Setting Up NFS Server On RHEL 8 / CentOS 8
Nfs Server: Hostname: Server1.Example.com Ip Address: 10.10.10.1
Nfs Client: Hostname: Server2.Example.com Ip Address: 10.10.10.2
dnf install nfs-utils or yum install nfs-utils
systemctl enable --now nfs-server.service OR
systemctl start nfs-server.service
systemctl enable nfs-server.service
systemctl status nfs-server.service
mkdir -p /mnt/nfs_shares
chown -R nobody: /mnt/nfs_shares/
chmod -R 777 /mnt/shares
vim /etc/exports
/mnt/nfs_shares 10.10.10.2(rw,sync,no_all_squash,root_squash)
exportfs -arv
exportfs -s
Firewall Configurations
firewall-cmd --permanent --add-service=nfs
firewall-cmd --permanent --add-service=rpc-bind
firewall-cmd --permanent --add-service=mountd
firewall-cmd --reload
Setting Up NFS Client on Client Systems
dnf install nfs-utils nfs4-acl-tools
showmount -e 10.10.10.1
mkdir -p /nfs_client
mount -t nfs 10.10.10.1:/mnt/nfs_shares /nfs_client
mount | grep nfs
Final TEST
touch /mnt/nfs_shares/nfsserver.txt [On NFS Server]
ls -l /nfs_client/ [On NFS Client]
umount /mnt/nfs_shares
exit