Red hat linux

Setting Up an NFS Server and Client on CentOS 7

I’m using two CentOS systems here:

NFS Server:, IP address:
NFS Client:, IP address:

Configure the Firewall

firewall-cmd --permanent --zone=public --add-service=nfs
firewall-cmd --reload

Installing NFS and enable and start the nfs server service.(Client / Server)

yum -y install nfs-utils
systemctl enable nfs-server.service
systemctl start nfs-server.service

Exporting Directories on the Server

mkdir /var/nfs
chown nfsnobody:nfsnobody /var/nfs
chmod 755 /var/nfs

Now we must modify /etc/exports where we “export” our NFS shares.

#vim /etc/exports
/home ,sync,no_root_squash,no_subtree_check)

#exportfs -a

Mounting the NFS Shares on the Client
First we create the directories where we want to mount the NFS shares

mkdir -p /mnt/nfs/home
mkdir -p /mnt/nfs/var/nfs

Afterwards, we can mount them as follows:

mount /mnt/nfs/home
mount /mnt/nfs/var/nfs

Open /etc/fstab and append the following lines:  /mnt/nfs/home   nfs      rw,sync,hard,intr  0     0  /mnt/nfs/var/nfs   nfs      rw,sync,hard,intr  0     0

Leave a Reply

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