Operations 7 min read

Configuring NFS Server and Client on CentOS

This guide explains how to install, configure, and start NFS services on a CentOS server, define export options, and mount the shared directories on client machines using commands such as showmount, exportfs, and mount, including persistent fstab configuration.

Practical DevOps Architecture
Practical DevOps Architecture
Practical DevOps Architecture
Configuring NFS Server and Client on CentOS

NFS (Network File System) allows multiple machines to share a common directory over the network; for example, three hosts A, B, and C can store images in a single directory on A and access it remotely.

Server-side setup

On CentOS, install the required packages with: yum install -y nfs-utils The nfs-utils package pulls in rpcbind (replacing the older portmap on CentOS 6+). Edit /etc/exports to define the shared directory and its options, e.g.:

/home/ 192.168.137.0/24(rw,sync,all_squash,anonuid=501,anongid=501)

The line consists of the local path, the allowed client IP/network, and a list of export options such as rw (read‑write), ro (read‑only), sync / async, no_root_squash, root_squash, all_squash, and anonuid/anongid for mapping users.

After saving the file, start the necessary services: /etc/init.d/rpcbind start; /etc/init.d/nfs start Client-side mounting

First ensure the client has nfs-utils installed, then list the server’s exports with: showmount -e 192.168.137.10 Mount the exported directory: mount -t nfs 192.168.137.10:/home/ /mnt/ Running df -h will show the newly mounted /mnt filesystem.

Managing exports without restarting

The exportfs command (options -a, -r, -u, -v) applies changes to /etc/exports on the fly. For example, after adding: /tmp/ 192.168.137.0/24(rw,sync,no_root_squash) run: exportfs -arv which will output the exported paths.

Advanced mounting options

Mount with the -o nolock option to disable file locking:

mkdir /test
mount -t nfs -o nolock 192.168.137.10:/tmp/ /test/

To make the mount persistent, add a line to /etc/fstab: 192.168.137.10:/tmp/ /test nfs nolock 0 0 After editing, unmount the temporary mount and run mount -a to verify the automatic mount works on boot.

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.

LinuxNFSCentOSNetwork File System
Practical DevOps Architecture
Written by

Practical DevOps Architecture

Hands‑on DevOps operations using Docker, K8s, Jenkins, and Ansible—empowering ops professionals to grow together through sharing, discussion, knowledge consolidation, and continuous improvement.

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.