KEMBAR78
NFS Server | PDF | Computer File | Directory (Computing)
0% found this document useful (0 votes)
2 views8 pages

NFS Server

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views8 pages

NFS Server

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

 In this project, I used two AWS instances (one as NFS server and one as

client) to configure file sharing using NFS on RHEL 9. I created a shared


directory on the server, set proper permissions, and mounted it on the
client system for seamless remote access.

Aws Cloud Instance Private IP Public IP Configured For


NFS-Server 172.31.95.180 34.201.59.134 NFS Server Setup
Client Server 172.31.84.57 100.24.34.169 NFS Client Configuration


 Setup of NFS Server

Step 1: Install the Packages using yum


 Package name: nfs-utils
 Command: yum install nfs-utils
Step 2: Verify that the packages were installed correctly
 Command: rpm -q nfs-utils

Step 3: Start and enable the NFS Server


 Service name: nfs-server
 Command: systemctl enable --now nfs-server

Step 4: Check the status of NFS server


 Command: systemctl status nfs-server

Step 5: Make a directory named /nfs-share


 Command: mkdir /nfs-share

 We will keep all the files in this folder that we want to share with
the client over the network.
Step 6: Configure NFS Server

 Edit the /etc/exports file.


 In this file, we define the folder we want to share along with the
client details, so the server knows which folder to share with which
client.
 Open the /etc/exports configuration file using vim
 Command: vim /etc/exports

 Add the following entries in this file.

 Explanation:
 /nfs-share – folder path we want to share
 100.24.34.169 – client IP that can access it
 rw – Client can read and write
 sync – Saves changes immediately
 no_root_squash – Allows client root user to act as root

Step 7: Apply the Export configuration


 Command: exportfs -arv

Step 8: Restart NFS Service to apply changes


 Command: systemctl restart nfs-server
Step 9: Configure SELinux for NFS
 By default, SELinux blocks NFS shares. So, we need to set the
correct SELinux context on the shared folder.
 Command: semanage fcontext -a -t nfs_t /nfs-share

 Relabel the folder so SELinux accepts the change


 Command: restorecon -Rv /nfs-share

Step 10: Allow Port 2049 in security group of NFS Server


 To allow NFS traffic, we need to open port 2049 in the security
group of the NFS server instance (in AWS).
 Setup of NFS Client

Step 1: Install the Packages using yum


 Package name: nfs-utils
 Command: yum install nfs-utils

Step 2: Create Mount Point


 We need a folder where we will mount the shared NFS directory.
 Command: mkdir /mnt/share-data

Step 3: Mount the Directory


 Now we will mount the shared folder from the NFS server to the
client system.
 Syntax: mount -t nfs <NFS_Server_IP>:/nfs-share /mnt/share-data
 Command: mount -t nfs 34.201.59.134:/nfs-share /mnt/share-data

Step 4: Verify the Mount


 Command: df -h | grep nfs
Step 5: Make the Mount Permanent
 Open /etc/fstab file using vim.
 Command: vim /etc/fstab

 Add the following entry in /etc/fstab file.


<NFS_Server_IP>:/nfs-share /mnt/share-data nfs defaults 0 0

 Apply mounting point


 Command: mount -a

Step 6: Test the NFS Share


 Now we will test if the NFS sharing is working properly or not.
 Go to the NFS server and create a test file inside the /nfs-share
directory:

 Now go to the NFS client and check if the same file is visible in the
mounted folder.

 Now you can see the same files on the client, which means the NFS
setup is working perfectly.
Conclusion
 NFS is a simple and reliable way to share files between systems on
the same network.
It helps in easy and fast access to shared data without using any
third-party tools.
 If you're learning Linux or DevOps, setting up NFS is a great hands-on
practice.
It improves your understanding of system administration and real-
time file sharing in Linux environments.

You might also like