Operations 11 min read

Master NFS: Step‑by‑Step Configuration on Rocky Linux

This guide explains what NFS is, walks through setting up a Rocky Linux NFS server and client, covers installing packages, configuring export directories, adjusting permissions, editing /etc/exports, enabling rpcbind and NFS services, opening firewall ports, and mounting the share on the client.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Master NFS: Step‑by‑Step Configuration on Rocky Linux

NFS Overview

NFS (Network File System) is a distributed file system protocol that enables file sharing over a network, allowing client machines to access and manipulate remote files and directories as if they were local. Developed by Sun Microsystems in 1984, it follows a client‑server model and supports operations such as read, write, create, delete, and permission management.

NFS Configuration

1. Experimental Topology

Two Rocky Linux 8.9 hosts are connected via the e0 NIC to the same network (Net1 with NAT). Both hosts can reach each other and the Internet; the e1 NIC connects to a management network for remote administration.

2. Server Setup

Install NFS utilities: # yum -y install nfs-utils Create a shared directory and grant write permissions:

# mkdir /nfsfile
# chmod 777 /nfsfile
# echo 'This is a nfs shared folder.' > /nfsfile/README

Check the default export file:

# ls -l /etc/exports
# rpm -qf /etc/exports

Edit /etc/exports to define the share and its options (no spaces between client address and options). Example to share /nfsfile with the 172.16.0.0/24 subnet with read‑write, synchronous writes, and root squashing: /nfsfile 172.16.0.*(rw,sync,root_squash) Key export options:

ro : read‑only

rw : read‑write

root_squash : map root client requests to anonymous UID/GID

no_root_squash : preserve root UID/GID

all_squash : map all client users to anonymous UID/GID

sync : write data to both memory and disk

async : write to memory first, then to disk (higher performance, risk of data loss)

Start and enable NFS and RPC services:

# systemctl restart rpcbind.service
# systemctl enable rpcbind.service
# systemctl enable --now nfs-server.service

Open firewall ports for NFS, rpcbind, and mountd:

# firewall-cmd --add-service=nfs --permanent
# firewall-cmd --add-service=rpc-bind --permanent
# firewall-cmd --add-service=mountd --permanent
# firewall-cmd --reload

3. Client Setup

Install NFS utilities on the client and view available exports:

# yum -y install nfs-utils
# showmount -e 172.16.0.100

Create a local mount point and mount the remote share:

# mkdir /nfsfile
# mount -t nfs 172.16.0.100:/nfsfile /nfsfile
# df -Th

Verify the shared file content:

# cat /nfsfile/README
This is a nfs shared folder.

To make the mount persistent, add an entry to /etc/fstab:

172.16.0.100:/nfsfile   /nfsfile   nfs   defaults   0   0
# mount -a

Additional Tips

Wildcards in /etc/exports can simplify IP matching: * for any host, 192.168.10.* for a /24 subnet, or a specific IP address for a single host.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

LinuxSystem AdministrationNFSRocky LinuxNetwork File Systemfile sharing
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.