Voiced by Amazon Polly |
Overview
Network File System (NFS) is a distributed file system protocol that allows sharing of files and directories across a network. This setup guide outlines the steps to configure an NFS server and client on Linux servers, enabling the sharing of resources between them. This can be especially useful for scenarios where multiple servers must efficiently access common data or storage resources.
Pioneers in Cloud Consulting & Migration Services
- Reduced infrastructural costs
- Accelerated application deployment
Introduction
Prerequisites
- Two Linux or Unix machines: One to act as the NFS server and the other as the NFS client.
- Administrative access to both the server and client machines.
- Basic knowledge of the Linux command line.
- A network connection between the two machines.
Step-by-Step Guide
- NFS Server and Client Setup:
To configure NFS, you will need two Linux or Unix machines, one to act as the server and the other as the client.
2. Login to Server
3. Install NFS on Server
1 |
sudo dnf install rpcbind nfs-utils -y |
- Now Enable and Start nfs-server and rpcbind:
- rpcbind –This service converts Remote Procedure Call (RPC) program numbers to universal addresses. This service helps computers on the network to communicate with each other.
1 2 3 4 |
sudo systemctl enable nfs-server sudo systemctl enable rpcbind sudo systemctl start nfs-server sudo systemctl start rpcbind |
- Be sure to enable inbound NFS traffic in the firewall:
If you are using AWS, allow inbound rule NFS to anywhere
Or
1 2 3 4 5 |
sudo yum install firewalld sudo reboot sudo firewall-cmd --permanent --add-service=nfs sudo firewall-cmd --reload sudo firewall-cmd --list-services |
- Now Create NFS Shared Directory
1 |
sudo mkdir -p /home/test/my_nfsshare |
7. Grant NFS clients read, write, and execute permissions on the directory
1 |
sudo chmod 777 -R /home/test/my_nfsshare |
8. Now, export an NFS share directory
1 2 |
sudo vim /etc/exports /home/test/my_nfsshare public_ip_client(rw,sync,no_root_squash,no_subtree_check) |
9. Finally, export the filesystem and view the NFS Share
1 2 |
sudo exportfs -rv showmount -e localhost |
10. Now Login to Client Account
11. Create a mount directory
1 |
sudo mkdir nfs_backup |
12. Next, we will attach the NFS share to the mount folder that we just created in the server directory
1 |
sudo mount -t nfs 13.233.196.219:/home/test/my_nfsshare ~/nfs_backup |
To make the NFS share permanent, change the file that controls which file systems are mounted at boot
1 |
sudo vim /etc/fstab |
1 |
13.232.72.72:/home/test/my_nfsshare /root/nfs_backup nfs defaults 0 0 |
13. On the server side, upload a file
1 |
sudo dd if=/dev/zero of=file.txt bs=10240 count=102400 |
14. To check that the file is uploaded on the server side
15. Now, finally, check to the client side
Conclusion
We have now finished setting up NFS so that a computer (the client) can access files stored on another computer (the server). We did this by installing the NFS software on both computers, creating a shared directory on the server, and mounting the shared directory on the client. We then tested NFS by accessing a file on the server from the client.
Drop a query if you have any questions regarding NFS and we will get back to you quickly.
Making IT Networks Enterprise-ready – Cloud Management Services
- Accelerated cloud migration
- End-to-end view of the cloud environment
About CloudThat
CloudThat is an official AWS (Amazon Web Services) Advanced Consulting Partner and Training partner, AWS Migration Partner, AWS Data and Analytics Partner, AWS DevOps Competency Partner, Amazon QuickSight Service Delivery Partner, AWS EKS Service Delivery Partner, and Microsoft Gold Partner, helping people develop knowledge of the cloud and help their businesses aim for higher goals using best-in-industry cloud computing practices and expertise. We are on a mission to build a robust cloud computing ecosystem by disseminating knowledge on technological intricacies within the cloud space. Our blogs, webinars, case studies, and white papers enable all the stakeholders in the cloud computing sphere.
To get started, go through our Consultancy page and Managed Services Package, CloudThat’s offerings.
FAQs
1. What is NFS?
ANS: – NFS, or Network File System, is a distributed file system protocol that allows users to access files over a network as if they were stored locally. NFS is a popular choice for file sharing between Unix and Linux systems, but it can also be used on other operating systems, such as Windows and macOS.
2. What are the benefits of using NFS?
ANS: – NFS offers several benefits, including:
- Ease of use: NFS is easy to set up and use. Once the NFS server and client are installed and configured, users can access shared files as if they were stored locally.
- Transparency: NFS is transparent to users, meaning they do not need to be aware that they are accessing files over a network.
- Scalability: NFS is scalable to support many users and files.
- Performance: NFS can provide good performance for most file sharing needs.
3. How do I set up NFS?
ANS: – To set up NFS, you must install the NFS server and client software on both the server and client computers. You must also configure the NFS server to export the directories you want to share. Once the server is configured, you can mount the shared directories on the client computers. For more detailed instructions on how to set up NFS, please see the documentation for your operating system.
WRITTEN BY Noopur Shrivastava
Noopur Shrivastava works as a Research Associate at CloudThat. She is focused on gaining knowledge of the Cloud environment. Noopur loves learning about new technology and trying out different approaches to problem-solving.
Click to Comment