How to enable NFS on CentOS 8

On both side

@ Install nfs-utils

dnf -y install nfs-utils

For server

@ Edit /etc/exports

/home/nfsshare 10.0.0.0/24(rw,no_root_squash)
/home/nfsshare *(rw,no_root_squash)
# More information about keywords in "()" please refer man page.

@ Launch the service and set the firewall

systemctl enable --now rpcbind nfs-server
firewall-cmd --add-service=nfs --permanent
firewall-cmd --add-service={nfs3,mountd,rpc-bind} --permanent
firewall-cmd --reload
exportfs -a
exportfs -r

@ (Optional) modify the domain name: edit /etc/idmapd.conf

# Line 5
Domain = <your_domain_name>

For client

@ Mount NFS

mount -t nfs <address>:/home/nfsshare /mnt
# Mount as version 3
mount -t nfs -o vers=3 <address>:/home/nfsshare /mnt
Leave a Reply

发表评论