Post banner photo

A Local Netflix - Plex Media Server

Author picture

Andreas Schöngruber

July 12th, 2022

Raspberry Pi

A few years ago, I set up a local Plex Media Server on my Raspberry Pi. It works like Netflix but with my local media files that are stored on an external hard drive. It saves the progress of watched files and provides additional information to the files, like episode descriptions.

My Raspberry Pi is running 24/7, and therefore all my files are always accessible from all my devices on my home network. Plex provides apps for all different kinds of devices, e.g., Android, Windows, and FireTV Stick.


  • Raspberry Pi
  • SD Card 16GB
  • LAN Cable or Wireless LAN Adapter
  • External Hard Drive

Raspberry Pi I would recommend a Raspberry Pi with Gigabit Ethernet and USB 3.0. I am using the Raspberry Pi 4 B.

SD Card 16GB Your Raspberry Pi needs an SD Card with an operating system installed. I am using Ubuntu Server.

LAN Cable or Wireless LAN Adapter Of course, we need access to the server. This can be achieved with a LAN Cable or a Wireless LAN Adapter for the Raspberry. I would recommend using a LAN Cable and connecting your Raspberry Pi directly to your router.

External Hard Drive We need a place where we store our media files. An external hard drive with enough space and USB 3.0 will work fine. You can use whatever you want or what you have in reach. I am using a Western Digital My Book 3TB with USB 3.0. I should replace it soon because it is already eight years old.


The following step-by-step guide shows you how to install the Plex Media Server and a Samba share on your Raspberry Pi. The Samba share is needed to easily drop files on your raspberry from all your devices in your home network.

Before we start with the installation, we should update the package list and all our packages by running the following commands:

sudo apt update
sudo apt upgrade

This might take a while.

Install Samba Share

Samba is a tool that allows us to easily share files with SMB/CIFS clients. It is quickly installed and set up.


Now let's install samba with the following command:

sudo apt install samba samba-common-bin -y

Mount Drive

We can now configure the share on our Raspberry Pi. We need to connect the external hard drive and mount it. First, we create a new folder that we will share.

This can be done with the following command:

mkdir /media/share

To mount our external hard drive, we need to get its name with the following command:

Blog-Image: lsblk output
Output of command lsblk

Now we can mount the drive manually with the following command:

sudo mount -t ext4 /dev/sda1 /media/share

-t ext4 The filesystem type. Ext4 is a popular Linux filesystem
/dev/sda1/ The drive name
/media/share The mount point

If that step is successful, we can mount the drive permanently by adding the following line to the file /etc/fstab:

/dev/sda1 /media/share auto noatime 0 0

Now the disk should get mounted automatically after each system reboot.

auto The filesystem will be mounted automatically at startup
noatime Disables writing file access times every time you read a file
0 Is the file system backed up: 0 - no, 1 - yes
0 Disable the filesystem check

For more information about the parameters, see fstab.

Samba Configuration

Now we need to adapt the samba config to share this folder. The config file is located at /etc/samba/smb.conf and can be adapted with any text editor we like, e.g., VIM.

Following needs to be added to the bottom of the file:

path = /media/share
writeable = Yes
create mask = 0644
directory mask = 0755
public = no

[share] is the name of our share. It is used when connecting to the share.
path = /media/share is the location of the shared directory.
writeable = Yes allows us to write data to the share.
create mask = 0644 defines the file permissions.
directory mask = 0755 defines the folder permissions.
public = no requires a valid user to connect to the share.

The next step is to create a user for the share with a password of our choice:

sudo smbpasswd -a pi


The final step is to restart the Samba share:

sudo systemctl restart smbd

Now we should be able to connect to our share.

Connect to your Samba Share from Windows

From a Windows PC, you can connect to the network share with the following command:

net use Z: \\<plex-server-ip>\share /USER:\myUserName myPassword

This will map the share to the drive letter Z, and you should see the share in Windows Explorer. Now you can easily move files to the share, which can then be streamed with Plex.

Install Plex Media Server

Plex is a tool that is used to stream media files. Plex provides clients for all different devices, e.g., Android, Windows, etc.

Add Plex Media Server repository

We need to add the Plex APT repository to our system. This can be done with the following command:

echo deb public main | sudo tee /etc/apt/sources.list.d/plexmediaserver.list

Import the GPG key with the following commands:

wget cat PlexSign.key | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/PlexSigkey.gpg

Let's update the package index again:

sudo apt update

Install Plex Media Server

Now that we have Plex in our package list, we can install it with the following command:

sudo apt install plexmediaserver -y

Check Status

After the installation, the Plex Media Server runs automatically. We just need to check its status with the following command:

systemctl status plexmediaserver.service
Blog-Image: Plex status
Plex Service Status

Configure Plex Media Server

We want Plex Media Server to start automatically on system boot. This can be achieved with the following command:

sudo systemctl enable plexmediaserver.service

You can now connect to your Plex Media Server and configure it to your liking. Open http://<plex-server-ip>:32400/web in your browser. You will need to create a free account and can then log in to your Plex Media Server.

Congratulations, you now have a self-made home NAS with a local Plex Media Server. Have fun watching!