Creating an NFS server to Centos/Alma/RedHat Linux
Created: 2024-05-09 01:41:27 | Last modified: 2024-05-09 01:51:35
Access: Read | Views: 13 | Rating: N/A | Tags:
How to create an NFS server on Centos, Alma, RedHat and Rocky Linux version 9
Instructions of how to create a simple NFS share on RPM based Linux.
Install the required packages
dnf install -y nfs-utils
Start and enable the new services
systemctl start nfs-server rpcbind
systemctl enable nfs-server rpcbind
Create a share, in this example I'll create a share under root
mkdir /nfsshare
CHMOD it to allow users to read and write into the current directory
chmod 777 /nfsshare
Edit the exports file and add the following
- 192.168.1.5 : This is the client IP address that is allowed to access the file share.
- (rw,sync,no_root_squash)
- rw: Read write permissions to the directory
- sync: all changes to files within this directory is immediately flushed to disk
- no_root_squash: Remote root users are able to change any file on the shared filesystem. You can leave this out and will default to the nfsnobody user
- You can add multiple lines to this file
vi /etc/exports
/nfsshare 192.168.1.5 (rw,sync,no_root_squash)
Export the shared directory
exportfs -r
Update the firewall to allow NFS into the server
firewall-cmd --permanent --add-service nfs
firewall-cmd --permanent --add-service mountd
firewall-cmd --permanent --add-service rpc-bind
firewall-cmd --reload