NFS (Network File System) is a distributed file system protocol that allows you to share directories and files over a network. In this guide, we will walk through the steps to install and configure an NFS server on Debian 11.

Step 1: Update Your System

Start by ensuring your system is up to date:

sudo apt update && sudo apt upgrade -y

Step 2: Install NFS Server

Install the NFS server package using the following command:

sudo apt install -y nfs-kernel-server

Step 3: Create a Directory to Share

Create a directory that you want to share over the network:

sudo mkdir -p /mnt/nfs_share

Add some test files to the shared directory:

echo "Hello NFS" | sudo tee /mnt/nfs_share/test.txt

Step 4: Configure Exports File

Edit the /etc/exports file to define the shared directory and its permissions:

sudo nano /etc/exports

Add the following line to the file:

/mnt/nfs_share *(rw,sync,no_root_squash)

This configuration allows all clients to mount the directory with read and write permissions.

Step 5: Start and Enable NFS Service

Start the NFS service and enable it to run at startup:

sudo systemctl start nfs-kernel-server
sudo systemctl enable nfs-kernel-server

Step 6: Configure Firewall (Optional)

If you have a firewall enabled, allow NFS traffic:

sudo ufw allow from /24 to any port nfs

Replace <client_IP> with the actual IP address of the client machine that will access the NFS share.

Step 7: Mount the NFS Share on the Client

On the client machine, install the NFS client package:

sudo apt install -y nfs-common

Create a mount point on the client machine:

sudo mkdir -p /mnt/nfs_client

Mount the NFS share using the following command:

sudo mount -t nfs :/mnt/nfs_share /mnt/nfs_client

Replace <server_IP> with the IP address of the NFS server.

Step 8: Verify the Mount

Check if the NFS share is mounted successfully:

df -h

You should see the NFS mount listed in the output.

Step 9: Configure Automatic Mounting (Optional)

To ensure the NFS share mounts automatically at boot, add the following line to the /etc/fstab file on the client machine:

<server_IP>:/mnt/nfs_share /mnt/nfs_client nfs defaults 0 0

Conclusion

You have successfully installed and configured an NFS server on Debian 11. This allows you to share files across your network easily.

If you're looking for a reliable hosting solution for your NFS server, consider using Windows VPS UK. With Windows VPS, you can efficiently host your applications and ensure high performance. Whether you need VPS UK Windows or Windows Virtual Private Servers, you'll find a solution that fits your requirements.

For larger deployments or enterprise needs, explore Windows Virtual Dedicated Server Hosting or Virtual Private Server Hosting Windows. Whether you're located in the UK, Italy, or elsewhere, Windows VPS Italy and UK VPS Windows offer reliable hosting options. Visit Windows VPS Hosting UK to discover the best hosting solutions for your file sharing needs.

Was this answer helpful? 0 Users Found This Useful (0 Votes)