What is an NFS Server?
Using the Network File Sharing (NFS) protocol, you can exchange files and directories across a network with other Linux clients. Usually, a file server running the NFS server component creates shared folders. Users share the files they add to the folders with other users who can access them.
When a client system mounts an NFS file share, it becomes accessible in the same way as locally generated user folders. When you need to transfer public data between client machines but have limited disk space, NFS comes in handy.
Here is a quick rundown of how NFS functions:
1 Configuring the server :
- Specific folders can be set to be shared with other systems on the NFS server.
- You set up the NFS server to export these folders with the appropriate access rights and permissions to NFS clients.
2 Access by Client :
- On their local file system, NFS clients are able to mount shared folders from the NFS server.
- The folders and files on the server appear to be a part of the client’s local file system after they are mounted.
3 Communication across a Network :
- NFS facilitates communication between the server and clients using the Remote Procedure Call (RPC) protocol.
- File sharing across systems is made possible by network-based communication.
4 File Management :
You can read, write, and execute files on shared directories and files on the NFS client just like you would on a local drive.
NFS servers, especially on Unix-like operating systems like Linux, offer a quick and easy means of sharing data and working together in a networked setting.
Installing the NFS server program and configuring the /etc/exports file to indicate which folders should be shared and with which systems are usually required to set up an NFS server on Linux. It could also be necessary for you to activate and launch the NFS server service.
When setting NFS, keep in mind that security is crucial. To safeguard your shared resources, make sure you have the right access rules and authentication methods in place.
Set up the NFS Server Package.
1 Verify that the package nfs-utils is installed. Installing it via the package manager—yum on Red Hat—is possible.
yum install nfs-utils libnfsidmap -y
2 Activate and Enable NFS Services :
systemctl start rpcbind.service nfs-utils.service nfs-server.service
systemctl enable rpcbind.service nfs-utils.service nfs-server.service
3 Create an NFS Share Directory :
mkdir -p /server/highsky
4 Parmesan The Mount Directory :
chmod 777 /server/highsky/
chmod 777 /server/
5 Set Export Configurations:
Add the directories you wish to share to the /etc/exports file to define them. To share the directory /shared_directory, for instance:
vim /etc/exports
/server/highsky *(rw,sync,no_root_squash)
File Serve And Exit
In this case, * permits connection from any client, rw grants access to both read and write, and sync guarantees that changes are committed to the disk prior to application.
6 The File System should be exported:
Modify the exports file as necessary:
exportfs -rv
7 Set Up a Firewall :
If you have the firewall turned on, let NFS traffic pass through:
firewall-cmd --permanent --zone=public --add-service=nfs
firewall-cmd --reload
2 options :
Turn off the firewall service.
systemctl stop firewalld.service
systemctl status firewalld.service
Set up the NFS Client :
1 Install the NFS Server Package :
yum install nfs-utils rpcbind -y
2 Firewall service Stop :
systemctl stop firewalld.service
systemctl status firewalld.service
2 Activate and Enable NFS Services :
systemctl start nfs-utils.service
systemctl start rpcbind.service
systemctl status nfs-utils.service
3 Showmount -e :
Showmount commands can be used to keep an eye on the NFS server:
showmount Server IP address
showmount -e 192.168.1.10
4 Create the Mount directory
Mounting the NFS share on the client from the server is the next step. We must construct a mount directory before we can proceed with this. In this instance, we’ll make a directory named
mkdir /mnt/sky
5 The NFS share will then be mounted to the mount directory we just created in the root home directory.
mount 192.168.1.10:/server/highsky /mnt/sky/
6 Go To Mount Directory And Check the mount point Sarver Said :
cd /mnt/sky
Create Directory
mkdir harry