How to set up an NFS server on Linux?

Setting up an NFS server on a Linux system is very simple, here are the basic steps:

  1. Install NFS server software package: Run the following command in the terminal to install the NFS server software package:
sudo apt-get update
sudo apt-get install nfs-kernel-server
  1. The file containing export configuration details.
  2. – Mounted shared folder
/mnt/shared 192.168.1.0/24(rw,sync,no_subtree_check)

This setup allows clients from the 192.168.1.0/24 network to access the /mnt/shared directory in read-write mode.

  1. Reload NFS configuration: run the following command to reload the NFS configuration file to apply the changes:
sudo exportfs -a
  1. Start the NFS server by running the following command.
sudo systemctl start nfs-server
  1. Set up NFS server to start automatically on boot by running the following command.
sudo systemctl enable nfs-server

You have now set up an NFS server on your Linux system, allowing other clients to access shared files by mounting NFS shared directories.

广告
Closing in 10 seconds
bannerAds