Wednesday, August 12, 2020

NFS Server on Linux

 

NFS server on linux

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

Network file system 


Introduction

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

NFS stands for network file system is a distributed file system protocol allows user on a client computer to access files over a computer network,Linux can be both NFS server and NFS client machine it means that it can export file system  to other systems and mount file systems exported from other machines



Configuring NFS server

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


Let us start the process

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


Step -1:  Install NFS server 


use the following command to install the NFS server


sudo apt -get update -y

sudo apt - get install nfs-kernel-server


sudo yum update -y

sudo yum install nfs-utils nfs-utils-lib -y


Step-2: Create a directory called  /nfs_share


mkdir /nfs_share


Step -3: edit the file /etc/exports and add the following line


vi /etc/exports


/nfs_share *(rw,sync)


/nfs_share - directory to be shared


*- clients allowed  to accessthe share,you can restrict it by ip address ,for example ,you could ,instead of the asterik,put 192.168.0.0/24 to restrict the clients on the network


rw - read and write acsess


sync - sync the disk before command completion


Step -4: Now run the exportfs command to export the directory


exportrf -avr


-a -----> exports or un -exports all directories

-r------> re-export all directories

-u------->un -exports one or more directories

-v--------> provides verbose output


Step-5: Resatrt the services and make it permanaent


sudo service nfs restart


sudo systemctl restart nsf


if you want NFS to start at boot ,use the following command


chkconfig --levels 235 nfs on


sudo systemctl enable nsf


Configuring NFS client

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

Step-1: install nfs package on the client machine


sudo apt -get update -y

sudo apt -get install nfs-common -y


yum install nfs-utils nfs-utils-lib -y


Step-2: Start the service


sudo service nfs restart

sudo chkconfig --levels 235 nfs on


sudo systemctl start nsf

sudo sytemctl enable nsf


Step-3: Show mount Command to view exportson an NFS server


showmount -e 192.168.10.03


Step-4: Make a Directory and mount NFS over it


mkdir /nfs_data

mount -t nfs 192.168.10.03 :/nfs_share /nfs_data



Step -5: Make it permanaent mount


edit  /etc/fstab and add the following line


vi  /etc/fstab


192.168.10.03:/nfs_share  /nfs_data nfs defaults  0 0



Once it mounted ,you can able to view the contents of the exported  files /directory locally





THANKS FOR VIEWING MY BLOG FOR MORE UPDATES FOLLOW ME 


ITIL Process

ITIL Process Introduction In this Blog i am going to explain  ITIL Process, ITIL stands for Information Technology Infrastructure Library ...