Install  NFS Server & Client  RHEL/CENTOS-8
install server

Install NFS Server & Client RHEL/CENTOS-8

Install NFS Server – share files or folders from one computer to another is a major problem. If we store our data in a computer and want to access it from any other system, then it becomes a big problem for us. To get rid of all these problems, through this article, we will try to know from the details about how to share files and folders from the network.

There are many ways to access a from one computer to another over the network . Of all these methods, today through this article, we will learn about NFS server.

In this Tutorials, we Learn About Install And Configure NFS Server & Client Step By Step-With Screenshot in RHEL-CENTOS and other Linux distribution

Install And Configure

  • by default In most distributions of Linux, the package of NFS is already installed. If the package of NFS is not installed in your system then you can install it in your system with the following command.
  • First install NFS packages in your system

#dnf install nfs-utilus

Install NFS server Package
  • Open the below file and go to line Number 5 uncomment and write your Domain Name.

Domain = simitech.in

Start NFS Services

  • With the command given below, you can start the service of nfs and also check the status of the service whether the service is started or not.

# systemctl enable –now rpcbind nfs-server # systemctl start nfs-server.service #systemctl enable nfs-server.service # systemctl status nfs-server.service

start ,enable,and check NFS Services,

Export data from NFS Server

  • In this step, you have to open the main configuration file of the NFS server which resides under / etc / export. You can share all the directories from NFS by giving permissions as per your choice.
  • As you can see in the step below, we first created a directory of Nfs-Share-Data which I want to share for a client from the NFS server
  • In the second command, you can see that what we created above the Nfs-Share-Data directory has been added to the nobody group. You can add Nfs-Share-Data to a group as per your requirement.
  • In the third command given below, we have given full permission to the Nfs-Share-Data directory.
  • Create Share Directories and Assign Permission
  • # mkdir -p /mnt/Nfs-Share-Data

# chown -R nobody: /mnt/Nfs-Share-Data

#chmod -R 777 /mnt/Nfs-Share-Data

Create Directory and change Permission

* Open the configuration file and add the following line.

/mnt/Nfs-Share-Data 10.0.2.15/24(rw,no_root_squash)

open NFS Export File
Syntax of Exports file in NFS Server

If you have properly configured all the methods given above, then you restart the service of nfs once again, this will reload the service once.

# systemctl restart nfs-server.service

Allow NFS service to firewall

It does not matter if the firewall service is turned off on your server. If you have started the service of the firewall in your system, then you can use the following command to allow the firewall to serve NFS.

# firewall-cmd –permanent –add-service mountd

#firewall-cmd –permanent –add-service nfs

#firewall-cmd –reload

Basic Option of Exports
OptionDescription
rwAllow both read and write requests on a NFS volume.
roAllow only read requests on a NFS volume.
syncReply to requests only after the changes have been committed to stable storage. (Default)
asyncThis option allows the NFS server to violate the NFS protocol and reply to requests before any changes made by that request have been committed to stable storage
no_root_squashTurn off root squashing. This option is mainly useful for disk-less clients.
all_squashMap all uids and gids to the anonymous user. Useful for NFS exported public FTP directories, news spool directories, etc.
no_all_squashTurn off all squashing. (Default)
insecureThis option accepts all ports.
wdelayDelay committing a write request to disc slightly if it suspects that another related write request may be in progress or may arrive soon. (Default)

NFS CONFIGURATION ON CLIENT SIDE

Follow the steps below to configure the client side NFS server

Install NFS Package in Client Side

Open bellow file and go to line Number 5 uncomment and write your Domain Name

Domain = simitech.in

Mount share nfs server share directories on client machine
Mount NFS share Directory

if you want to mount the shared data from the server to the client system forever so that you can access the share drive even after your system is restarted, for this process you can execute the following bellow step one bu one in your system

configure /etc/fstab file

# vim /etc/fstab

#NFS Server name or IP:/share directories /mount point defaults 0 0

192.168.100.10:/mnt/Nfs-Share-Data /mnt/ Defaults 0 0

Permanent Mount NFS Share Directory In fstab

In this Tutorial, We Learn How to Install And Configure NFS Server In Centos Step By Step both the Server and Client Side. If you like the information given by it, then you can share it on your social media and your friend.