How to configure NFS Server in CentOS 7, Redhat 7 and Fedora - Linux tech Solutions

Share on :

How to configure NFS Server in CentOS 7, Redhat 7 and Fedora

NFS: NFS stands for Network File System, it is an internet standard protocol used by Linux and other operating systems. It is an open standard under active extentions which supports native Linux permissions.
Now let us Create our own NFS Server :-

Server Side Configuration:-

1)Firstly download the nfs-utils package from the link given below :

Nfs-Utils

2)Now go to the Downloads Directory :-

[email protected] #  cd /root/Downloads

3)Install the package using the command:

[email protected] # rpm  -ivh  nfs-utils-1.3.0-0.33el7.x86_64.rpm

4)Then Create Directory which you want to share:

[email protected] #  mkdir  /share
[email protected] #  mkdir  /share2

5)Now give full permission to the Directory which you want to share.

[email protected] #  chmod  777  /share
[email protected] #  chmod  777  /share2

6)Now edit the exports file using the command:

[email protected] #  vim  /etc/exports

Inside the export file you have to give:

/share [Client PC IP] /share2 [Client PC IP]

To Know the Client PC IP.run#ifconfig command in client PC to know the client pc ip.

Now type the IP in the exports file, give read write permission on the shared directory /public and read only permission to /private.

/share  190.168.43.9[rw,sync]      # rw for read write permission
/share2  190.168.43.9[ro,sync]      # ro for read only permission

Save and quit the exports file .

7)Now export the file.

[email protected] # exportfs -a
[email protected] # exportfs -r
[email protected] # exportfs -vf

8)Now start the Nfs Service.

[email protected] # systemctl start nfs
[email protected] # systemctl enable nfs

9)Now apply the firewall rule.

[email protected] # firewall-cmd  --permanent  --add-service=nfs
[email protected] # firewall-cmd  --permanent  --add-service=rpc-bind
[email protected] # firewall-cmd  --permanent  --add-service=mountd
[email protected] # firewall-cmd  --reload

We have sucessfully configured our Server machine.

Client Side Configuration:-

1)Firstly download the nfs-utils package from the link given below :

Nfs-Utils

2)Now go to the Downloads Directory :-

[email protected] #  cd /root/Downloads

3)Install the package using the command:

[email protected] # rpm  -ivh   nfs-utils-1.3.0-0.33el7.x86_64.rpm

4)Now run showmount command to check the exports from the Server PC.

[email protected] # showmount -e 192.168.43.3

5)Go to the vim /etc/fstab file and make the entries.

192.168.43.3:/share  /mnt/share  nfs  defaults,_netdev  0  0
192.168.43.3:/share2  /mnt/share2  nfs  defaults,_netdev  0  0

6)Create a mount point for shared directory from server.

[email protected]  #  mkdir  /mnt/share
[email protected]  #  mkdir /mnt/share2

7)Now mount both the directories

[email protected]  #mount  -a

Our shared directories have mounted.
We have successfully configured NFS Server both client and server side.
--------------------------------------------------------------------------
The Video Below is a detailed Explaination


Share on :

You may also like...

Leave a Reply

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