RedHat - Install NFS Shares
NFS Server Configuration
Install NFS Utilities.
sudo dnf install nfs-utils
Create the Shared Directory.
sudo mkdir -p /nfs/exports/myshare
(Replace /nfs/exports/myshare with your desired path.)
Configure NFS Exports: Edit the /etc/exports file to define the directories to be shared and the clients allowed to access them.
sudo nano /etc/exports
Add a line similar to this, replacing client_ip_address with the actual IP address or hostname of your NFS client:
/nfs/exports/myshare client_ip_address(rw,sync,no_root_squash)
rw: Read/write access.
sync: Synchronous writes to disk.
no_root_squash: Prevents root user on the client from being squashed to an anonymous user on the server. Use with caution.
Apply Export Configuration.
sudo exportfs -rav
Start and Enable NFS Services.
sudo systemctl enable --now rpcbind nfs-server
Configure Firewall: Allow NFS traffic through the firewall.
sudo firewall-cmd --permanent --add-service=nfs
sudo firewall-cmd --permanent --add-service=mountd
sudo firewall-cmd --permanent --add-service=rpc-bind
sudo firewall-cmd --reload