Note: This is a RHCE 7 exam objective.
Install the NFS packages:
# yum groupinstall -y "file-server"
Add a new service to the firewall:
# firewall-cmd --permanent --add-service=nfs Success
Reload the firewall configuration:
# firewall-cmd --reload Success
Activate the NFS services at boot:
# systemctl enable rpcbind # systemctl enable nfs-server # systemctl enable nfs-lock
Start the NFS services:
# systemctl start rpcbind # systemctl start nfs-server # systemctl start nfs-lock
Create a directory to export (here /shared):
# mkdir /shared
Create a dedicated group (here called sharedgrp):
# groupadd -g 60000 sharedgrp
Assign this group to the new directory:
# chgrp sharedgrp /shared
# chmod 2770 /shared
Edit the /etc/exports file and add the following lines with the name (or IP address) of the client(s):
Export the directories:
# exportfs -avr # systemctl restart nfs-server
Note1: The client needs to have access to the same group (via LDAP) and be a member of this group.
Note2: The last command shouldn’t be necessary in the future. But, for the time being, it avoids rebooting.