How To Set Up an NFS Mount on Ubuntu 16.04

How To Set Up an NFS Mount on Ubuntu 16.04

How To Set Up an NFS Mount on Ubuntu 16.04

Network File System (NFS) is a distributed file system protocol that allows a user on a client computer to access files over a network in a manner similar to how local storage is accessed. This tutorial will show you how to set up an NFS mount on Ubuntu 16.04.

Step 1: Install the Required Packages

The first step is to install the NFS client and server packages on the Ubuntu machine. This can be done with the following command:

sudo apt-get install nfs-kernel-server nfs-common

Once the packages are installed, you can proceed to the next step.

Step 2: Create the Shared Folder

You need to create a folder on the server that you want to share with the clients. For this tutorial, we will create a folder named "shared" in the root directory.

sudo mkdir /shared

Next, you need to change the ownership of the folder to the NFS server's user and group. In this example, the user is "nfsnobody" and the group is "nogroup".

sudo chown nobody:nogroup /shared

Once the folder has been created and the ownership has been changed, you can proceed to the next step.

Step 3: Configure the NFS Export

You need to configure the NFS export on the server. This is done by editing the "/etc/exports" file.

sudo nano /etc/exports

Add the following line to the file to share the "shared" folder with all clients:

/shared *(rw,sync,no_subtree_check)

The "rw" option allows clients to read and write to the folder, "sync" ensures that changes are synchronized between the server and clients, and "no_subtree_check" disables subtree checking, which can improve performance.

Once you have added the line, save and exit the file.

Step 4: Restart the NFS Service

After making changes to the "/etc/exports" file, you need to restart the NFS service for the changes to take effect.

sudo systemctl restart nfs-kernel-server

Step 5: Mount the Shared Folder on the Client

You can now mount the shared folder on the client machine. For this tutorial, we will mount the folder to "/mnt/shared" on the client.

First, you need to create the mount point:

sudo mkdir /mnt/shared

Next, you can mount the folder using the following command:

sudo mount server_ip:/shared /mnt/shared

Replace "server_ip" with the IP address of the NFS server.

Once the folder has been mounted, you can access its contents as if it were a local folder.

Conclusion

Комментарии

Популярные сообщения из этого блога

How To Modify CSS Classes in JavaScript

How To Backup MySQL Databases on an Ubuntu VPS

How To Backup PostgreSQL Databases on an Ubuntu VPS