Last Updated on August 9, 2026 by skraito with Lord Jesus Christ
To set up an NFS (Network File System) server on Linux, install nfs-kernel-server (Ubuntu/Debian) or nfs-utils (RHEL/Fedora), create a shared directory, define the export rules in /etc/exports with client IP addresses and permissions, restart the NFS service, and mount the share on client machines.
Set Up the NFS Server
- Install the server package:
- Ubuntu/Debian:
sudo apt update && sudo apt install nfs-kernel-server - RHEL/Fedora/Rocky:
sudo dnf install nfs-utils
- Ubuntu/Debian:
- Create a directory to share:
sudo mkdir -p /mnt/nfs_share - Adjust folder permissions so clients can access it:
sudo chown nobody:nogroup /mnt/nfs_share(or set custom permissions) [1, 2, 3] - Edit
/etc/exportsusing a text editor to add your share rules:/mnt/nfs_share 192.168.1.0/24(rw,sync,no_subtree_check) - Export the shared directories:
sudo exportfs -a - Enable and start the service:
sudo systemctl enable --now nfs-server - Allow NFS through your firewall (e.g., UFW):
sudo ufw allow from 192.168.1.0/24 to any port nfs
Set Up the NFS Client
- Install client utilities:
- Ubuntu/Debian:
sudo apt install nfs-common - RHEL/Fedora/Rocky:
sudo dnf install nfs-utils
- Ubuntu/Debian:
- Create a local mount point directory:
sudo mkdir -p /mnt/client_share - Mount the remote share temporarily to test:
sudo mount -t nfs 192.168.1.100:/mnt/nfs_share /mnt/client_share - Make the mount permanent across reboots by adding this line to
/etc/client's /etc/fstab:192.168.1.100:/mnt/nfs_share /mnt/client_share nfs defaults,nofail 0 0
Watch this step-by-step video guide to see a live demonstration of configuring an NFS server and mounting it on a client system: