Step-by-Step Guide to Setting Up NFS on Rocky Linux 8.9
This tutorial walks through installing NFS utilities, configuring the server and client, setting export permissions, enabling required services and firewall rules, and mounting the shared directory permanently on Rocky Linux 8.9 systems.
What Is NFS?
Network File System (NFS) is a distributed file‑system protocol that allows files on a remote server to be accessed and manipulated as if they were on a local disk. Originally released by Sun Microsystems in 1984, NFS works on a client‑server model and supports operations such as read, write, create, delete, and permission management across different operating systems and hardware platforms.
Experimental Topology
Two Rocky Linux 8.9 hosts (named nfs-server and nfs-client) are connected to the same network via the e0 NIC (with NAT on Net1) and to a management network via e1 for remote administration.
Server Configuration
Install NFS utilities
yum -y install nfs-utils # Install the NFS utilities packageVerify installation:
rpm -qa | grep nfs # List installed NFS‑related packagesCreate and prepare the shared directory
mkdir /nfsfile # Create the export directory
chmod 777 /nfsfile # Grant read/write/execute to everyone
echo 'This is a nfs shared folder.' > /nfsfile/READMEConfigure export permissions
Edit /etc/exports and add a line that maps the directory to the client subnet. No spaces are allowed between the client address and the option list.
vim /etc/exports
/nfsfile 172.16.0.*(rw,sync,root_squash)Common export options:
ro : read‑only
rw : read‑write
root_squash : map client‑side root to anonymous UID/GID
no_root_squash : preserve client root privileges
all_squash : map all client users to anonymous
sync : write data to both memory and disk before replying
async : write to memory first for better performance (risk of data loss)
Start and enable required services
systemctl restart rpcbind.service
systemctl enable rpcbind.service
systemctl enable --now nfs-server.serviceOpen firewall ports
firewall-cmd --add-service=nfs --permanent
firewall-cmd --add-service=rpc-bind --permanent
firewall-cmd --add-service=mountd --permanent
firewall-cmd --reloadClient Configuration
Install NFS utilities and view exports
yum -y install nfs-utils # Install client utilities
showmount -e 172.16.0.100 # List exports from the serverOutput example:
/nfsfile 172.16.0.*Mount the shared directory
mkdir /nfsfile
mount -t nfs 172.16.0.100:/nfsfile /nfsfile
df -Th # Verify the mountPersist the mount via /etc/fstab
# Add the following line to /etc/fstab
172.16.0.100:/nfsfile /nfsfile nfs defaults 0 0After editing, run mount -a to apply the changes.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Liangxu Linux
Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
