How to install NFS on Redhat Or Fedora

A Network File System (NFS) allows remote hosts to mount file systems over a network and interact with those file systems as though they are mounted locally. This enables system administrators to consolidate resources onto centralized servers on the network.


 






Server Ip : 10.10.10.1
Client  Ip : 10.10.10.2

An NFS server on linux requires 3 services to be running in order to share files:
1.portmap
2.nfslock
3.nfs

Server Settings [10.10.10.1]:

Install nfs package using yum :
# yum install nfs-utils nfs-utils-lib portmap system-config-nfs

# chkconfig portmap on
# chkconfig nfslock on
# chkconfig nfs on



Set up your /etc/exports file with details of the directory you want to share, who is allowed to share it, and permissions.
# vim /etc/exports
/home/vishal 10.10.10.2 or 10.10.10.0/255.255.255.0(rw,no_root_squash,sync)

# service nfs restart

Client Settings [10.10.10.2]:-
Install NFS packages:
# yum install nfs-utils nfs-utils-lib portmap system-config-nfs

# mkdir /home/vishal
# chmod 777 /home/vishal

Mount command:
# mount -t nfs 10.10.10.1:/home/vishal /home/vishal

Add an entry to fstab:
Paste an entry at the bottom of the file that looks something like this.

10.10.10.1:/home/vishal         /home/vishal    nfs     noauto,rw,user 0 0

Make sure you can see the running services on the server by typing:

#rpcinfo -p 10.10.10.1 [Server Ip]

Thanks,
Vishal Vyas



1 comment: