Tuesday, March 31, 2015

nfs server configuration in linux step by step .




Network Fail System; it is default file sharing service in UNIX environment.

NFS called as a distributed file system. It allows remote user to access files over the network .

NFS fallows client & server architecture.

NFS versions     : NFSv2, NFSv3 and NFSv4 

Packages :   nfs-utils 

Config file         : /etc/exports

Services : nfs and  rpcbind

Port number : nfs --->2049

Daemon : nfsd, locked and statd.

NFS, or Network File System, is a server-client protocol for sharing files between computers on a common network. NFS enables you to mount a file system on a remote computer as if it were local to your own system. You can then directly access any of the files on that remote file system. The server and client do not have to use the same operating system. The client system just needs to be running an NFS client compatible with the NFS server. 


Configuration of NFS Server 

NFS Server is used to share the folder among Linux/Unix to Linux/Unix systems. 
Step 1 ) CHECK & INSTALL PACKAGES 

[root@nfs ~]# rpm -qa | grep nfs 
or 
[root@nfs ~]# yum list installed | grep nfs
[root@nfs ~]# yum remove nfs* -y
Method 1) Installing through rpm
[root@nfs ~]# mkdir /mnt
[root@nfs ~]# mount 192.168.0.250:/var/ftp/pub/Server /mnt
[root@nfs ~]# mount
[root@nfs ~]# cd /mnt 
[root@nfs mnt]# ls 
[root@nfs mnt]# rpm -ivh nfs* --force 
Method 2 )Installing through yum 
[root@nfs mnt]# yum install nfs* -y 
Step 2) Create the resources (Files/Folders) to be shared 
[root@nfs ~]# mkdir /var/zoom 
[root@nfs ~]# mkdir /var/salesdept 
[root@nfs salesdept]# chmod 777 /var/zoom 
[root@nfs salesdept]# chmod 777 /var/salesdept/ [root@nfs ~]# cd /var/zoom/ 
[root@nfs zoom]# touch zfa.txt zfb.txt zfc.txt [root@nfs zoom]# mkdir zdira zdirb zdirc 
[root@nfs zoom]# ls 
[root@nfs zoom]# cd /var/salesdept 
[root@nfs salesdept]# touch sfa.txt sfb.txt sfc.txt [root@nfs salesdept]# mkdir  sda sdb sdc 
[root@nfs salesdept]# ls -l 
Step 3) Add the entries of folders to be shared in /etc/exports file 
[root@nfs ~]# vi /etc/exports 
/var/zoom 192.168.0.0/255.255.255.0(ro,async)
/var/sales 192.168.0.10(rw,sync) 192.168.0.20(rw,async)
:wq! 
Step 4 ) Start the Services 
[root@nfs ~]# service nfs restart 
Step 5) Check the list of shares form NFS server Syntax : showmount -e <nfs_server_name/ip> 
[root@nfs ~]# showmount -e 192.168.0.4 

Client Side Configuration 


To see the list of shares from NFS server 
[root@client ~]# ssh 192.168.0.Y 
Where Y is any Client IP 
[root@client ~]# showmount ±e 192.168.0.X
Where X is NFS server IP
[root@client ~]# mkdir /misc/nfs1 /misc/nfs2
[root@client ~]# mount 192.168.0.X:/var/zoom /misc/nfs1
[root@client ~]# mount 192.168.0.X:/var/sales /misc/nfs2
[root@client ~]# mount
[root@client ~]# ls /misc/nfs1
[root@client ~]# ls /misc/nfs2

No comments:

Post a Comment