=^.^=

Basic NFS Server and Client on RHEL/CentOS, Debian/Ubuntu and Derivatives

karma

Server

Install the NFS utilities, start and configure the service to run automatically on boot:

RHEL/CentOS
dnf install nfs-utils nfs4-acl-tools systemctl enable nfs-server.service systemctl start nfs-server.service

To configure firewalld to permit network access to the NFS services run:
firewall-cmd --permanent --add-service=nfs firewall-cmd --permanent --add-service=rpc-bind firewall-cmd --permanent --add-service=mountd firewall-cmd --reload

Debian/Ubuntu
apt install nfs-kernel-server rpcbind systemctl enable nfs-kernel-server systemctl start nfs-kernel-server

To configure ufw to permit network access to the NFS services run:
ufw allow from 192.168.0.0/24 to any port nfs ufw enable

Configuration files are located at /etc/nfs.conf and /etc/nfsmount.conf.

Create or edit /etc/exports:
/mnt/share1 192.168.0.0/24(ro) /mnt/share2 192.168.0.0/24(rw,async) /mnt/share3 192.168.0.0/24(rw,sync) /mnt/share4 192.168.0.0/24(rw,sync,no_all_squash,root_squash)

Specify the single IP address or range in CIDR notation that a share should be accessible to followed by its options in (brackets).

See man exports for detailed information about per-share configuration options.

To reload the exports configuration live, run:
exportfs -ar

To configure disk quotas please see Mass Virtual Hosting Part Three: Disk Quotas (including NFS).

Client

RHEL/CentOS
dnf install nfs-utils nfs4-acl-tools

Debian/Ubuntu
apt install nfs-common

To view the exported shares on the remote server:
showmount -e 192.168.0.100

To mount a remote share:
mount -t nfs 192.168.0.100:/mnt/share1 /mnt/shared

To add a remote share to fstab (automatically mount at boot, simplified mount /mountpoint):
192.168.0.100:/mnt/share1 /mnt/shared nfs defaults 0 0

Comments

There are no comments for this item.