Last time we talked about setting up a plex server, but where should we put all the media? Of course you can store your media on the same server that plex is running, but where's the fun in that?
Here's a step-by-step guide to set up an NFS server on Ubuntu 24.04 and connect to the NFS share from another server:
Setting Up NFS Server on Ubuntu 24.04
-
Update and Install NFS Server:
sudo apt update sudo apt install nfs-kernel-server
-
Create the Directory to Share:
Create the directory you want to share and set the appropriate permissions.
sudo mkdir -p /home/fsuser/share sudo chown -R nobody:nogroup /home/fsuser/share sudo chmod 777 /home/fsuser/share
-
Configure NFS Exports:
Edit the
/etc/exports
file to add the directory you want to share.sudo nano /etc/exports
Add the following line to share the directory with a specific subnet (e.g.,
192.168.1.0/24
):/home/fsuser/share 192.168.1.0/24(rw,sync,no_subtree_check)
rw
: Read/write access.sync
: Synchronous write operations.no_subtree_check
: Prevents subtree checking.
-
Apply the Export Configuration:
sudo exportfs -a
-
Restart NFS Server:
sudo systemctl restart nfs-kernel-server
-
Adjust Firewall (if necessary):
If you have a firewall running, ensure that NFS traffic is allowed.
sudo ufw allow from 192.168.1.0/24 to any port nfs sudo ufw reload
Connecting to NFS Share from Another Server
-
Install NFS Client:
On the client server, install the NFS client package.
sudo apt update sudo apt install nfs-common
-
Create a Mount Point:
Create a directory where you want to mount the NFS share.
sudo mkdir -p /mnt/share
-
Mount the NFS Share:
Manually mount the NFS share to test the connection.
sudo mount 192.168.1.169:/home/fsuser/share /mnt/share
Replace
192.168.1.169
with the IP address of your NFS server. -
Verify the Mount:
Check if the NFS share is mounted.
df -h /mnt/share
-
Automate the Mount at Boot:
To make the NFS share mount automatically at boot, add an entry to
/etc/fstab
.sudo nano /etc/fstab
Add the following line:
192.168.1.169:/home/fsuser/share /mnt/share nfs defaults 0 0
Save the file and exit the editor.
-
Test the Configuration:
Unmount and remount to test the
/etc/fstab
configuration.sudo umount /mnt/share sudo mount -a
By following these steps, you should be able to set up an NFS server on Ubuntu 24.04 and connect to the NFS share from another server.