Setup NFS Server and Client on RHEL 7 / CentOS 7

In this tutorial i will show you how to setup a NFS server  and client on Redhat 7 / CentOS 7 The same steps can be used in Fedora bas...


In this tutorial i will show you how to setup a NFS server  and client on Redhat 7 / CentOS 7


The same steps can be used in Fedora based systems also instead of yum you have to use dnf.

NFS stands for Network File System which allows end systems to mount file systems over a network and interact with those as they are mounted locally

Redhat 7 added support to the NFS version 4.1 , which has a lot of performance and security

NFS Server Setup

For setting up the nfs server we need a CentOS 7 or redhat 7 , i am using CentOS 7 as NFS server and RHEL 7 as client

Step 1 : Install the nfs packages
yum -y install nfs-utils libnfsidmap
Step 2 : Start the NFS services and enable the services to work even after reboots
  • systemctl start rpcbind
  • systemctl enable rpcbind
  • systemctl start nfs-server
  • systemctl enable nfs-server
  • systemctl start nfs-lock
  • systemctl start nfs-idmap
Step 3 : Create a folder and share it over network

Create a folder in your server and provide the necessary permissions , i created a folder under "/" partition and providing 777 to it
mkdir /myshare
chmod 777 /myshare
Now we need to make a entry in /etc/exports file to make the share available on the client systems
/myshare 192.168.211.140(rw,sync,no_root_squash)
where
  • /myshare - is the shared folder to the clients
  • 19.168.211.140 - NFS server ip
  • rw - Allows to read and write on the shared dir
  • ro - Allows to read the contents in the shared dir
  • sync - allows to sync
  • no_root_squash - Any file request made by user root on the client machine is treated as made by user nfsnobody in the server
Once the export file is modified we need to export the share dir listed in exports file using the below
exportfs -a

Step 4 : Configure Firewall

we need to add the below rules on nfs server, so that clients can access the shared dir
firewall-cmd --permanent --zone public --add-service mountd
firewall-cmd --permanent --zone public --add-service nfs
firewall-cmd --permanent --zone public --add-service rpc-bind
firewall-cmd --reload

NFS Client Setup

Step 1 : Install the nfs pacakges on client
yum -y install nfs-utils libnfsidmap
Step 2 : Start the necessary services
  • systemctl start rpcbind
  • systemctl enable rpcbind
  • systemctl start nfs-server
  • systemctl enable nfs-server
  • systemctl start nfs-lock
  • systemctl start nfs-idmap
Step 3 : Check the shared NFS dir by using showmount
showmount -e serverip

Step 3 : Mount the shared dir on the client
mount -t nfs {NFS server ip}:(shared dir) (Mountpoint)
eg :
mount -t nfs 192.168.211.140:/myshare /mnt
Step 4 : Verify it

For checking use df -h  or mount command


Automounting NFS share

Upto whatever we did is a temporary , if you  need it to permanent then the entry need to be in fstab
serverip:/myshare /mnt nfs defaults 0 0

COMMENTS

Name

0 A.D,1,Amazon Quiz,1,Android,1,Android Guide,1,Android Updates,4,Atom,6,Audacious,3,Audacity,2,Automation,1,Avidemux,1,Black Friday Deals,1,BleachBit,1,Blender,7,Bluefish,2,Bluehost,14,Bluehost Coupons,25,Brackets,2,Calibre,2,CDROM,1,CentOS,105,CentOS 8,3,CherryTreeEditor,1,Cinnamon,1,Clementine,1,Coupons,21,Darktable,8,Debian,14,digikam,6,Disable nouveau drive,1,Docker,1,Domain coupons,2,Domaincoupons,2,Driver,1,DVDROM,1,editor,3,Fail2Ban,1,Fedora,76,Fedora 26,12,FFmpeg,4,Firefox,32,firefox61,3,FlightGear,1,Foodpanda,1,Fotoxx,3,FreeOffice,1,Frostwire,1,GatewayIP,1,Gimp,5,Git,19,Google Chrome,1,HandBrake,1,Hostgator,1,Hostgator Coupons,1,How,2,How To,573,HPLIP,15,iPage,1,iPage Coupons,1,Kdump,1,KeePassXC,2,kernel,51,Kodi,12,Krita,7,Libreoffice,13,Linux,1,Linux Mint,22,LinuxMint,308,LVM,1,MariaDB,1,MIUI,5,MKVToolNix,11,Mobile News,3,Musicplayer,1,MyThemeShop,2,MyThemeShop coupons,2,Namecheap,5,Netbeans,1,NFS,1,NFS Server,1,Nuvola,1,NVIDIADriver,21,Oh-My-Zsh,1,OnePlus,1,OnePlus Buds,1,OpenOffice,2,opensource,1,openSUSE,2,Opera,2,OPPO Updates,1,OS Upgrade,1,OTA Update,1,Pidgin,3,pinta,1,Plasma,2,POCO,1,POCO F1 Update,1,qBittorrent,3,Redhat,31,Redhat 8,1,Redmi Note 7 Pro Update,1,Redmi Note 9 pro MAX Update,1,Redmi Note 9 pro Update,1,RedmiNote7proUpdate,1,Rhythmbox,1,runlevel,1,SiteGround,9,SiteGround Coupons,7,Skype,6,SMPlayer,2,SparkyLinux,1,SSH,1,Stellarium,3,Sudo,1,Tesla Coupons,1,TeslaThemes,2,Themes,1,TORbrowser,3,Ubuntu,537,uGet,3,Upgrade,2,Video Editor,1,VidMasta,1,Virtualbox,28,Vivaldi Browser,3,VLC,5,VxVM,1,Wavebox,1,Webhosting tutorials,2,Wine,21,Winrar,1,Wireshark,19,
ltr
item
askmetutorials: Setup NFS Server and Client on RHEL 7 / CentOS 7
Setup NFS Server and Client on RHEL 7 / CentOS 7
https://4.bp.blogspot.com/-cRnDVlf_fSY/WGMtp3qxaiI/AAAAAAAAEiY/JxiD_URmiM8JuuW-VxzhwOO0PJunCl5SQCPcB/s1600/RHEL-logo1.png
https://4.bp.blogspot.com/-cRnDVlf_fSY/WGMtp3qxaiI/AAAAAAAAEiY/JxiD_URmiM8JuuW-VxzhwOO0PJunCl5SQCPcB/s72-c/RHEL-logo1.png
askmetutorials
https://www.askmetutorials.com/2017/02/setup-nfs-server-and-client-on-rhel-7.html
https://www.askmetutorials.com/
https://www.askmetutorials.com/
https://www.askmetutorials.com/2017/02/setup-nfs-server-and-client-on-rhel-7.html
true
7830501603203534059
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy Table of Content