Skip to content
How to Set Up NFS Server and Client Auto‑Mount on CentOS 7
Operations 5 min read

How to Set Up NFS Server and Client Auto‑Mount on CentOS 7

This guide walks you through installing NFS on CentOS 7, creating a shared directory, configuring export options, starting the service, and then configuring a client to automatically mount the share using /etc/fstab, with verification steps included.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations

NFS Server Configuration

Install NFS service: yum install nfs-utils Create shared directory: mkdir -p /nfs/data Edit NFS exports file: Open /etc/exports and add the line: /nfs/data/ *(insecure,rw,sync,no_root_squash) The asterisk (*) denotes all clients, rw grants read‑write access, and sync forces synchronous writes. Other options such as no_root_squash control root permissions.

Apply NFS configuration: exportfs -ra Start NFS service:

systemctl start nfs
systemctl enable nfs

Verify NFS service:

showmount -e 192.168.178.224
NFS export list
NFS export list

NFS Client Configuration

Install NFS client: yum install nfs-utils Disable firewall (optional): Ensure the firewall allows NFS and rpcbind ports or temporarily disable it.

Edit /etc/fstab: Add the following line, replacing the server IP if needed:

192.168.178.224:/nfs/data /nfs/data nfs defaults 0 0

Here 192.168.178.224:/nfs/data is the server export, /nfs/data is the local mount point, and nfs specifies the filesystem type.

Mount the NFS share: mount -a Or mount manually: mount 192.168.178.224:/nfs/data /nfs/data/ Verify the mount: df -h The output should list the NFS share with its size and usage.

Mounted NFS share
Mounted NFS share

These are the complete steps to configure an NFS service on CentOS 7 and set up a client for automatic mounting.

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 administrationNFSnetwork file systemfile sharingCentOS 7
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.