NFS Server & Client Configuration in RHEL 8 | How To Configure NFS4 in Linux | Nehra Classes
Vložit
- čas přidán 26. 08. 2024
- NFS:
====
Network File System (NFS) is a distributed file system protocol originally developed by Sun Microsystems (Sun) in 1984, allowing a user on a client computer to access files over a computer network much like local storage.
NFS4 Configuration in RHEL 8 (CentOS 8):
==================================
An acronym for Network File Share, NFS is a cross-platform client/server protocol that allows clients machines to access files shared by the NFS server over a network. Client systems can locally mount the filesystems from the NFS server and access files and directories as though they were locally mounted. In this guide, we will walk you through the installation and configuration of NFS Server on CentOS 8 / RHEL 8.
Note: In CentOS 8 or RHEL 8 NFSv3 & v4 both are supported. NFSv3 allows safe asynchronous write and supports 64-bit file sizes & offset. Whereas NFSv4 works through OS firewall and support ACL (Access Control List) and doesn’t require rpcbind service
dnf install nfs-utils -y
systemctl start nfs-server.service
systemctl enable nfs-server.service
systemctl status nfs-server.service
rpcinfo -p | grep nfs
mkdir -p /mnt/nfs_shares/docs
chown -R nobody: /mnt/nfs_shares/docs
chmod -R 777 /mnt/nfs_shares/docs
systemctl restart nfs-utils.service
vim /etc/exports
/mnt/nfs_shares/docs 192.168.2.103(rw,sync,no_all_squash,root_squash)
cat /etc/exports
/mnt/nfs_shares/docs 192.168.2.103(rw,sync,no_all_squash,root_squash)
Let’s look at the meaning of the parameters used:
rw - This stands for read/write. It grants read and write permissions to the NFS share.
sync - The parameter requires the writing of the changes on the disk first before any other operation can be carried out.
no_all_squash - This will map all the UIDs & GIDs from the client requests to identical UIDS and GIDs residing on the NFS server.
root_squash - The attribute maps requests from the root user on the client-side to an anonymous UID / GID.
To export the above created folder, use the exportfs command as shown:
exportfs -arv
exportfs -s
firewall-cmd --permanent --add-service=nfs
firewall-cmd --permanent --add-service=rpc-bind
firewall-cmd --permanent --add-service=mountd
firewall-cmd --reload
Client Configuration:
---------------------
dnf install nfs-utils nfs4-acl-tools -y
showmount -e 192.168.2.102
mkdir -p /mnt/client_share
mount -t nfs 192.168.2.102:/mnt/nfs_shares/docs /mnt/client_share
mount | grep -i nfs
192.168.2.102:/mnt/nfs_shares/docs /mnt/client_share nfs defaults 0 0
Testing NFS Server & Client Setup:
----------------------------------
touch /mnt/nfs_shares/docs/server_nfs_file.txt
ls -l /mnt/client_share/
touch /mnt/client_share/client_nfs_file.txt
ls -l /mnt/nfs_shares/docs
As you can see, you can easily create files on both the NFS server and client and share them seamlessly between the two systems as well as other client systems that have been configured to access the shares. And this brings us to the end of our tutorial today. In this guide, we showed you how to install and setup the NFS server and client system setup on CentOS 8 and RHEL 8.
====
My i5 10 Gen Laptop With 512 GB SSD & 8 GB DDR4:
amzn.to/30amhRt
====
My DSLR Camera:
amzn.to/36954Ml
===
Join this channel to get access to perks:
/ @nehraclasses
===
Thanks for watching the video. If it helped you then, please do like & share it with others as well. Feel free to post your queries & suggestions, we will be glad to answer your queries.
If you like our hard work then do subscribe to our channel & turn on the bell notification for latest updates.
===
Contact Us:
Follow our all social media accounts @NehraClasses
Vikas Nehra's Twitter Handle: bit.ly/VikasNeh...
Vikas Nehra's FB Account: / er.vikasnehra
Vikas Nehra's Instagram Handle: / er.vikasnehra
Registration Form: bit.ly/NehraCla...
Twitter Handle: bit.ly/NehraCla...
Facebook Page: nehraclasses
Instagram: / nehraclasses
Telegram Channel: t.me/NehraClasses
WhatsApp Us: bit.ly/2Kpqp5z
Email Us: nehraclasses@gmail.com
===
©COPYRIGHT. ALL RIGHTS RESERVED.
Is it mandatory to install nfs4-acl-tools in client and should a firewall be enabled in the server? I have an Open Firewall application to control my Virtual environment so I don't prefer using firewalls inside the system. How do you determine its NFS-v4 is only been used in both the ends.
The nfs4-acl-tools packages provide utilities for managing NFSv4 Access Control Lists (ACLs) on files and directories mounted on ACL-enabled NFSv4 file systems.
Its a good practice if you use firewall at the server and if firewall is enabled at your server and you want to provide service to clients then you will have to add the rule for ports/services in firewall so that clients can connect to server to avail the services.
You can use nfsstat command to check the details of nfs on server as well as on clients.
Thanks for you comment.
amazing video as well as excellent explaination
thanking you sir
Good one
I am unable to create files on nfs client, It says permission denied error
please share command history and logs in our telegram channel.
awesome
How to Deny Delete Permission to some user in RHEL/ Cent OS / Ubuntu (Like windows OS Permission) ?
You can either lock the user or disable user login
@@NehraClasses I want Deny Delete only, I want give all other permission like Create, Write, Read, Execute etc..
Do we same configuration on cent os 8 also...
Yes, CentOS and RHEL are similar
good info video sir, i m newbie, how shall i make sure both linux machine communicate to each. as shown in ur video both ip in same subnet. i m using vmware. please provide any link if possible
Thanks in advance..:)
please use bridge network adaptor vmware settings, or ping us on our telegram group.