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:
- 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
- The file containing export configuration details.
- – 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.
- Reload NFS configuration: run the following command to reload the NFS configuration file to apply the changes:
sudo exportfs -a
- Start the NFS server by running the following command.
sudo systemctl start nfs-server
- 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.