*NFS (Network File System)
NFS used for sharing files over network between
☼ Linux → Linux
☼ Linux ↔ Unix
☼ Unix → Unix
1- Installing Packages: (nfs4, nfs-utils, rpcbind (On Server Machine)
- [root@server2 ~]# yum install nfs* -y (install nfs4 + utilities + rpcbind. “-y= yes”)
- [root@server2 ~]# rpm -qa |grep nfs (check nfs if installed successfully)
- [root@server2 ~]# rpm -qa |grep rpcbind (check rpcbind if installed successfully)
2- Restarting the services
- [root@server2 ~]# service rpcbind restart
- [root@server2 ~]# service nfs restart
- [root@server2 ~]# service nfslock restart
3- Turn on these Services permanently
- [root@server2 ~]# chkconfig nfs on
- [root@server2 ~]# chkconfig nfslock on
- [root@server2 ~]# chkconfig rpcbind on
4- Create some folder to be shared or Share existing folder
♫ [root@server2 ~]# mkdir /nfs/resource -p
♪ [root@server2 ~]# mkdir /nfs/projects -p
[root@server2 ~]# mkdir /nfs/software –p
ü [root@server2 ~]# mkdir /nfs/media –p
5- Edit Export file “located at” /etc/exports
ý vi /etc/exports (Don’t worry this is an Empty file, add folder name and folder path that you want to share with permission type) Example:
» /nfs/software *(rw,sync)
» /nfs/resource 192.168.78.0/24(ro,sync)
» /nfs/projects *.server1.com, *.sever2.com(rw,sync)
» /nfs/media 192.168.78.130/32(rw,sync) (press “ESC” →:wq← =save and Exit
Note: *=Any user / rw=Read Write permission / ro=Read Only permission / sync=Synchronize / 192.168.78.0/24=Permission for all 254 node on this network /*.server1.com, *.sever2.com= Permission for all Member of server1.com and server2.com/ 192.168.78.130/32= Permission for only this IP
6- Restarting nfs service,→ check shared resources → re Export Shared resources (optional)
v [root@server2 nfs]# service nfs restart
v [root@server2 nfs]# showmount -e localhost OR
v [root@server2 nfs]# showmount -e 192.168.78.101 (*change to your own IP “View All shared Resources)
v [root@server2 nfs]# exportfs -ra (Optional only for double Ensure “-ra”= Re Export All Shared directories)
7- Configure Clint Machine
© [root@clint ~]# yum install nfs* -y
© [root@clint ~]#showmount -e server2.com (Use Server Name or Server IP “View All shared Resources Server)
© [root@clint ~]# mkdir /mnt/nfs -p (optional create new folder )
© [root@clint ~]# mount -t nfs server2.com:/nfs/software /mnt/nfs (Mount software folder “Server IP can be used instead of Sever name )
© [root@clint ~]# echo $? (if output “0” = mounted successfully, if output not “0”= there is a problem)
© [root@clint ~]# cd /mnt/nfs
© [root@clint nfs]# ls
© [root@clint nfs]# vi /etc/fstab (permanent mount for shared folder’ “just add 1 line at the bottom of the fstab file)
» server2.com:/nfs/software /mnt/nfs nfs default 0 0
2 Comments
its a useful information…!!!!
NFS server configuration is important for linux base user so thanks