Debian / Ubuntu Linux: Setup NFSv4 File Server
Here's how you can set up an NFSv4 file server on a Debian-based Linux system (such as Debian or Ubuntu):
- Install the necessary packages:
sudo apt-get update sudo apt-get install nfs-kernel-server - Create a directory that will be shared over NFS. This directory will be the root of the NFS file system. For example:
sudo mkdir /nfs - Modify the ownership and permissions of the directory to allow clients to access it. For example:
sudo chown nobody:nogroup /nfsrnsudo chmod 755 /nfs - Edit the
/etc/exportsfile to add the directory that you want to share over NFS. The/etc/exportsfile is used to configure the NFS file server. You can add the following line to the file:/nfs *(rw,sync,no_root_squash) - Restart the NFS server to apply the changes:
sudo systemctl restart nfs-kernel-server
mount -t nfs SERVER:/nfs /mntWhere SERVER is the IP address of the NFS server, and /mnt is the mount point on the client system.
Note that this setup assumes that you are using NFSv4. If you want to use an earlier version of NFS, you may need to make additional modifications to your setup.
