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
- 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
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
* Open the configuration file and add the following line.
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
Basic Option of Exports
|rw||Allow both read and write requests on a NFS volume.|
|ro||Allow only read requests on a NFS volume.|
|sync||Reply to requests only after the changes have been committed to stable storage. (Default)|
|async||This 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_squash||Turn off root squashing. This option is mainly useful for disk-less clients.|
|all_squash||Map all uids and gids to the anonymous user. Useful for NFS exported public FTP directories, news spool directories, etc.|
|no_all_squash||Turn off all squashing. (Default)|
|insecure||This option accepts all ports.|
|wdelay||Delay 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
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
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
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.