At first, we need to prepare the virtual machine we are going to deploy the NFS Server. These are the characteristics of the virtual machine.
- O.S: CentOS 7 (64-bit)
- vCPU: 2
- RAM: 8 GB
- HDD: 16 GB
Next, we need to install these packages on the CentOS server with yum:.
yum install nfs-utils
And them, we need to create the directory that will be shared by NFS.
Change the permissions of the folder as follows.
chmod -R 755 /nfs#
chown nfsnobody:nfsnobody /nfs
Next, we need to start the services and enable them to be started at boot time.
systemctl enable rpcbind
systemctl enable nfs-server
systemctl enable nfs-lock
systemctl enable nfs-idmap
systemctl start rpcbind
systemctl start nfs-server
systemctl start nfs-lock
systemctl start nfs-idmap
Next, we need to install nano to share the NFS directory over the network a follows.
yum install nano
And them …
# nano /etc/exports
We will make two sharing points /nfs. Edit the exports file as follows:
Finally, start the NFS service
# systemctl restart nfs-server
Again we need to add the NFS service override in CentOS 7 firewall-cmd public zone service as:
firewall-cmd --permanent --zone=public --add-service=nfs firewall-cmd --permanent --zone=public --add-service=mountd firewall-cmd --permanent --zone=public --add-service=rpc-bind firewall-cmd --reload
Hoping you have enjoyed this post, see you next time.