Configuring NFS
Installation & Setup
(Guidance based on RHEL/CentOS
77, packages and commands may differ depending on OS)Wheninstalling====================================================================================
NFSSHARE SERVER CONFIGURATION
1. Install NFS
most chose either NFSv3 or NFSv4, if you have no specific reason to chose one then go with the latter. You can install thispackages onCentOS/RHELNFSwithServerthe following:SERVER: (172.45.55.64)yum install nfs-utils rpcbind2.
Start on-bootIf this is not a cluster then start these at boot time:
systemctl enable --now rpcbind nfs-server nfs-lock nfs-idmap3.
AddexportsthisOnce installed, we can look to configure the nfs share within the /etc/exports
file:vim /etc/exportsAdd the below config (updated with IP of the client server that need to be able to access the nfsshare.
/nfsshare172.45.55.65(IP_IP_IP_IP(rw,sync,no_root_squash)To specify multiple client servers, add separate lines, as below:
/nfsshare IP_IP_IP_IP(rw,sync,no_root_squash) /nfsshare IP_IP_IP_IP(rw,sync,no_root_squash) /nfsshare IP_IP_IP_IP(rw,sync,no_root_squash)Once
Followedadded,by:you can publish the exports changes using the below command:exportfs -a=================================================================================
CLIENT:NFS
CLIENT CONFIGURATION(172.45.55.65)1. Install the required NFS packages:
yum install nfs-utils2.
Testing:Mount the NFSSHARE (won't persist reboot until next step):Firstly, create the file path that you wish for the NFSSHARE to be mounted to:
mkdir /nfsshare&&The below command mounts the NFSSHARE. Ensure to replace the IP_IP_IP_IP:nfsshare with the NFS server IP, and location of the NFSSHARE on the NFS server. Finally, also ensure to update the second /nfsshare on the command to the path you wish for the share to be mounted to on the client server.
mount -t nfs172.45.55.64:IP_IP_IP_IP:/nfsshare /nfsshare3.
IfTest the configurationTest that mounting the nfsshare has worked using the df -h command. You should now see an entry dedicated to the NFSSHARE, as below:
4. Permanently configure the NFSSHARE
Once you've confirmed that the NFSSHARE is working, you can then look to add the fstab entry that will allow thisworks then you're sorted - add thisconfiguration to persist time & reboots.vim /etc/fstab:Add the below link, ensuring the update the syntax as mentioned above
172.45.55.64:IP_IP_IP_IP:/nfsshare /nfsshare nfs rw,relatime,vers=4,_netdev,timeo=100,retrans=4 0 0
- Lastly run:
mount -a