31.6 C
Jaipur
Tuesday, September 21, 2021

Install and Configure NFS – Linux Hint

Must read

Network File System (NFS) is an application that allows users to access and modify files on a remote computer as if they are accessing the local storage of their own computer. It is what is called a distributed file system, and it serves as a centralized filing system for a large network of computers.

NFS works with networks shared by systems with different operating systems. The administrator can also select which sections of the mounting information are made available to the client systems.

This article shows you how to install and configure NFS on your ArchLinux system.

Step 1: Set Up NFS packages

First, we will install the packages for NFS. To do so, issue the following command:

$ sudo pacman -S nfs-utils

Step 2: Set NFS to Launch at Startup

Use the commands below to set NFS to launch at startup:

$ chkconfignfs on

$ service rpcbind start

$ service nfs start


Now, NFS should launch at the startup.

Step 3: Share Directory with Client

Next, you will select a directory to share with the client and move it to /etc/exports. Use the command below to do so:


Then, append this line to the files:

# /share 192.168.87.158(rw,sync,no_root_squash,no_subtree_check)

Finally, export these files with the command below:

Step 4: Prepare the Client

The synchronization will require certain packages that you can download with the commands below:

$ sudo pacman -S nfs-utils

Step 5: Mount the Shared Directory

Once the packages are installed on the remote computer, it is now time to mount the shared directory:


Then, mount the shared directory:

$ mount 192.168.87.156:/share /mnt/share/


Run a confirmation test to see if the share is mounted:


Type in #mount to list the mounted file systems:

Running A Test

Bring over the contents to be distributed to the client through the server share directory. Type in the following command to run a test:

$ touch test1

$ mkdir test


Go to the /mnt/share folders in the remote computer that is serving as the client:


Then, add the entries in the /etc/fstab file to automatically mount the shared folder permanently.

Append the /etc/fstab file with the following lines:


This should mount the share folder files and all its contents.

Using NFS

We will now go over some of the options specific to NFS that might come in handy:

Fire up the terminal on the server and type the command below to see the contents up for sharing on the client machine:


To see the contents up for sharing on the server, you can use a variation of this command. Type the command below:

$ showmount -e 192.168.87.156


The following command allows you to list all the share files on the server:

To clear the /etc/exports location and send contents back to the source, enter the following:

Conclusion

NFS is a very simple, yet exceptionally convenient, network file sharing application. The extensive central filing system of NFS saves tons of HDD space, as many folders present on the host no longer need to be stored on each computer. The straightforward interface of NFS allows users to access the server for contents as they would access the local storage.

Keep in mind that NFS is susceptible to many exploitative attacks from the internet. As such, you should also consider setting up a firewall to protect your host from these attacks.

That is all we have for today. Stick around at linuxhint.com for more articles like this. We will post follow-ups to this particular post.

Source link

- Advertisement -

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisement -

Latest article