NEW LOCATION

Olá Brazil Brazil NVMe-powered VPS Plans in Brazil Now Available.

Deploy Instantly
  • +357 2425 0808
  • Login
  • English

Home

Blog

How To Install and Configure NFS Server ...

How To Install and Configure NFS Server on Debian 12 and Ubuntu 22.04

How To Install and Configure NFS Server on Debian 12 and Ubuntu 22.04

NetShop ISP

NetShop ISP · Blog Author

Nov 28, 2023 · Technical Tutorials

NFS stands for Network File Share and it’s a common protocol used for sharing files and directories over a local or public network. In simple terms, it is a shared directory where other clients (computers, servers) can easily access them.

In this article we will show the simple steps of installing and configuring the NFS server on Ubuntu 22.04 and Debian 22 servers; the commands are identical for both environments.

Steps to Install NFS Server on Debian 12 & Ubuntu 22.04

While writing this tutorial we used the root account on a Debian 12 server. If you are using a non-root account please prepend “sudo” in all of the following commands, e.g. sudo apt update.

Step 1: Update Packages

First step is to update our system’s packages by running this command:

root@localhost:~$ apt update -y

Step 2: Install NFS Server

You are now ready to install NFS Server on your Ubuntu or Debian server through apt, as follows:

root@localhost:~$ apt install nfs-kernel-server -y

Sample Output:

nfs-kernel-server installation on debian 12 – sample output

At this point NFS has been successfully installed on your system. We are not done yet though. Let’s proceed to configure our NFS server so remote NFS clients can start connecting to it.

Steps to Configure NFS Server on Debian 12 & Ubuntu 22.04

Step 1: Create the directory to be shared

In our example we are creating the directory named “share_me” under /home.

root@localhost:~$ mkdir /home/share_me

Step 2: Set directory & file permissions

It is important to set the right permissions on your newly created directory, so that all client machines can access it:

root@localhost:~$ chown -R nobody:nogroup /home/share_me

In similar way, we set the permissions for the files. In our example we are giving permissions to read, write and execute to all files under /home/share_me:

root@localhost:~$ chmod 777 /home/share_me/

Step 3: Grant NFS Access

This is the most important step in configuring an NFS server. The right access must be given depending on who you want to be able to access your shared directory.

Edit the file /etc/exports using the nano editor:

root@localhost:~$ nano /etc/exports

Add the following line(s) in the end of the file:

/home/share_me 192.168.10.3/32 (rw,sync,subtree_check)
/home/share_me 172.16.1.230/32 (rw,sync,subtree_check)

In our example, we have granted access to two individual IPs (192.168.10.3 , 172.16.1.230) to access our NFS Shared directory. Feel free to adjust as needed.

Regarding the parameters that follow the IP address, please take a look at this guide.

Now, save and exit the file.

Step 4: Export the NFS directory

The following command will export your newly created NFS directory:

root@localhost:~$ exportfs -a

Step 5: Restart NFS Server & Auto-start on Boot

Changes will be applied by restarting NFS server as follows:

root@localhost:~$ systemctl restart nfs-kernel-server

Then, ensure that the service auto-starts on server boot:

root@localhost:~$ systemctl enable nfs-kernel-server

Finally, firewall plays an important role whether remote clients will be able to access your NFS share or not.

Port 2049 is the one responsible for NFS protocol, so allow it on your firewall (firewalld, iptables or ufw).

That’s all! Congratulations on setting up your NFS Server on Debian 12 or Ubuntu 22.04 server!

Press Releases
79

Free VPS Trial

No Credit Card Required.

Recent Posts

Black Friday & Cyber Monday Offer – 30% Lifetime Discount on VPS Plans

Black Friday & Cyber Monday Offer – 30% Lifetime Discount on VPS Plans

02 December, 2024

How To Install Sendy on Ubuntu 22.04 Server

How To Install Sendy on Ubuntu 22.04 Server

27 November, 2024

How To Extract Certificates and Private Key from .PFX file

How To Extract Certificates and Private Key from .PFX file

19 November, 2024

NetShop ISP CEO Stefano Sordini to Moderate Key Panel on Forex AI Automation at Cyprus Fintech Summit 2024

NetShop ISP CEO Stefano Sordini to Moderate Key Panel on Forex AI Automation at Cyprus Fintech Summit 2024

15 November, 2024

Preparing for the Daylight Saving Time (DST) Change: Essential Updates for MetaTrader 4/5 Platforms

Preparing for the Daylight Saving Time (DST) Change: Essential Updates for MetaTrader 4/5 Platforms

25 October, 2024

#letushostyou

Award Winning Hosting Provider established in 2004.

120 Faneromenis Avenue, Imperial Tower, 2nd Floor, Larnaca 6031, Cyprus

Products

Bare Metal Servers

Customized Servers

Virtual / Cloud Servers

Forex VPS

Storage VPS

cPanel Web Hosting

Reseller Web Hosting

Colocation

Addons

Premium DNS

Email Hosting

Cloud Backup

DDoS Protection

Licenses

SSL Certificates

Domain Names

Premium SLAs

About Us

Data Center Locations

Looking Glass

Our Company

Contact Us

Careers in Cyprus

Become a Partner

Awards

Certifications

© 2024 S.S. NetShop Internet Services Ltd. All rights reserved.  Terms & Conditions  |  Privacy Policy
CY Reg. Number: HE 217340 | EU VAT Number: CY10217340J

Visa
Mastercard
PayPal
Bitcoin
Tether
Ethereum
Litecoin
Wise
Revolut
Wire Transfer