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

Share on :

How to configure NFS Server with Automounting 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  /public

[email protected] #  mkdir  /private



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


[email protected] #  chmod  777  /public

[email protected] #  chmod  777  /private



6)Now edit the exports file using the command:


[email protected] #  vim  /etc/exports



Inside the export file you have to give:



/public [Client PC IP]

/private [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.


/public  190.168.43.9[rw,sync]      # rw for read write permission

/private  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 autofs package in the terminal using the link given below:



Autofs-Package



2)Now go to the Downloads Directory :-


[email protected] #  cd /root/Downloads



3)Install the package using the command:


[email protected] # rpm  -ivh  autofs-5.0.5-73.el6.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 auto.master file and make the entries.

[email protected]  # vim  /etc/auto.master

  /mnt  /etc/auto.txt



6)Now go to the auto.txt file and make entries.

[email protected] #vim /etc/auto.txt

#[public -ro,sync, (SERVER IP)]

public  -ro,sync,  192.168.43.3:/public

private  -rw,sync,  192.168.43.3:/private



7)Now start the autofs Service.

[email protected]  #systemctl  start  autofs

[email protected]  #systemctl  enable  autofs



8)Now mount both the directories

[email protected]  #mount  -a



Now our shared directories have been mounted successfully.



We have successfully configured NFS and Automounting is working fine.

--------------------------------------------------------------------------

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 *