This is a simple guide, part of a series I'll call 'How-To Guide Without Ads'. In it, I'm going to document how I create an NFS share in Linux on a Raspberry Pi.
$ sudo apt-get install -y nfs-kernel-server
Create a shared directory
$ sudo mkdir /mnt/mydrive/shared $ sudo chmod -R 777 /mnt/mydrive/shared
I won't deal with permissions in this post; read this post for more suggestions.
Configure NFS to share that directory
Edit the NFS exports file with
sudo nano /etc/exports, and add the following:
Update the NFS active exports
sudo exportfs -ra
Connect to the share
From another computer, access:
Just a note if connecting from a Mac running macOS Big Sur: I was having some trouble mounting NFS shares via the Finder, so I found the only way to get the mount to work was by running the following command in the Terminal:
See AskDifferent issue: Can't mount NFS share in Big Sur. Crashes with NFSv4, rpc error with v3.
I know this doesn't really matter but add the -p flag for the mkdir command. That way it will make the parent folder as well.
sudo mkdir /mnt/mydrive/shared -p
Hope this helps a little