Partner with experts to accelerate your digital transformation journey
Bobcares

Complete Guide to Installing NFS Server and Client on RHEL Systems

PDF Header PDF Footer

Learn how to Install NFS Server and Client on RHEL-based Distributions easily. Our NFS Support team is ready to assist you. 

Install NFS Server and Client on RHEL-based Distributions

This guide explains how to install and configure NFS services, create and share directories, set up an NFS client, and verify access, enabling seamless file sharing across Linux/Unix systems.

Install and Configure NFS Services

Network File System (NFS) allows Linux servers to share directories and files with other systems over a network. By following this guide, you can easily install and configure NFS Server on RHEL to enable seamless file sharing. The process covers updating system packages, installing NFS utilities, starting and enabling NFS services, verifying their status, configuring firewall access if needed, and exporting shared directories for client access.

Install NFS Server and Client on RHEL-based Distributions

  1. Update System Packages and Install NFS Utilities
sudo yum update -y
sudo yum install -y nfs-utils rpcbind
  1. Enable and Start NFS Services
sudo systemctl enable rpcbind
sudo systemctl start rpcbind
sudo systemctl enable nfs-server
sudo systemctl start nfs-server
  1. Verify NFS Service Status
sudo systemctl status rpcbind
sudo systemctl status nfs-server
  1. Configure Firewall (Optional)
sudo firewall-cmd --permanent --zone=public --add-service=nfs
sudo firewall-cmd --reload
  1. Export Shared Directories

Add the shared directory to /etc/exports and export it:

echo "/shared_data 192.168.1.100(rw,sync,no_root_squash)" | sudo tee -a /etc/exports
sudo exportfs -arv

Configure Firewall for NFS

  1. Allow NFS Service
sudo firewall-cmd --zone=public --add-service=nfs --permanent

Replace public with your active zone if different (firewall-cmd –get-active-zones).

  1. Allow mountd and rpc-bind Services
sudo firewall-cmd --zone=public --add-service=mountd --permanent
sudo firewall-cmd --zone=public --add-service=rpc-bind --permanent
  1. Reload Firewall to Apply Changes
sudo firewall-cmd --reload

Create and Export NFS Share

To share directories over the network using NFS, you first need to create the shared folder, set proper permissions, and configure the NFS exports. After setting up, you can export the share and restart the NFS service to apply changes.

  1. Create the Shared Directory
sudo mkdir -p /srv/nfs/share
  1. Set Permissions
  • Full access for all users (use cautiously in production):
sudo chmod 777 /srv/nfs/share
  • Alternatively, set ownership for specific users/groups as needed.
  1. Edit /etc/exports
sudo nano /etc/exports

Add a line for your client(s):
/srv/nfs/share client_ip_or_hostname(rw,sync,no_subtree_check)
  • rw: read/write access
  • sync: writes changes to disk before confirming
  • no_subtree_check: improves performance, disables subtree checks
  1. Export the Share
sudo exportfs -a
  1. Restart NFS Service
sudo systemctl restart nfs-kernel-server
  1. Verify Exported Shares
showmount -e

Configure NFS Client

  1. Verify Server Exports
showmount -e nfs_server_ip

Lists directories exported by the NFS server.

  1. Create Mount Directory
sudo mkdir -p /mnt/nfs_share
  1. Mount the NFS Share
sudo mount nfs_server_ip:/path/to/exported_directory /mnt/nfs_share
  1. Persist Mount in /etc/fstab

Edit /etc/fstab and add:

nfs_server_ip:/path/to/exported_directory /mnt/nfs_share nfs defaults 0 0

Example:
sudo nano /etc/fstab
# Add:
192.168.1.100:/data/nfs_share /mnt/nfs_share nfs defaults 0 0
  1. Test Persistent Mount
sudo umount /mnt/nfs_share
sudo mount -a
df -h

Confirms the NFS share mounts automatically at boot.

Verify and Manage NFS Shares

  1. Verify Shared Files on the NFS Server
  • Check Exported Shares:
showmount -e
  • Verify File Presence:
ls -l /path/to/exported/directory
  1. Verify Shared Files on the NFS Client
  • Check Mount:
df -h
  • Access Shared Files:
ls -l /path/to/client/mountpoint

Test creating, modifying, or deleting files to confirm read/write access.

  1. Unmount NFS Shares on the Client
  • Unmount the Share:
sudo umount /path/to/client/mountpoint
  • Remove Persistent Mount (Optional):
sudo nano /etc/fstab

Comment out or remove the NFS entry to prevent automatic mounting at boot.

[Need assistance with a different issue? Our team is available 24/7.]

Conclusion

By following these steps, you can efficiently install NFS Server and Client on RHEL-based Distributions, enabling secure file sharing, persistent mounts, and easy management of shared directories across your network.

In brief, our Support Experts demonstrated how to fix the “554 5.7.1 : Relay access denied” error.

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Get featured on the Bobcares blog and share your expertise with a global tech audience.

WRITE FOR US
server management

Spend time on your business, not on your servers.

TALK TO US

Or click here to learn more.

Speed issues driving customers away?
We’ve got your back!