How to setup a Raspberry PI Plex Server

Plex is a great way of sharing all your media including Films, TV Shows Music and Photos to any client on your Network

Follow the guide if you need to on how to
Prepare an SD Card for Raspberry PI

When the PI is on and ready login via a SSH Session on through the terminal and run

sudo apt-get update

sudo apt-get upgrade

Next Add the Official Plex Repository

sudo apt-get install apt-transport-https

now add the plex repository’s to the apt keyrings directory (copy all below as one line)

curl https://downloads.plex.tv/plex-keys/PlexSign.key | gpg –dearmor | sudo tee /usr/share/keyrings/plex-archive-keyring.gpg >/dev/nulll

now we can add the official plex repository to the sources list (copy all below as one line)

echo deb [signed-by=/usr/share/keyrings/plex-archive-keyring.gpg] https://downloads.plex.tv/repo/deb public main | sudo tee /etc/apt/sources.list.d/plexmediaserver.list

now run the update again to refresh the repository list

sudo apt-get update

Install plex Server

sudo apt install plexmediaserver

Now the installer will setup 2 new directories
/var/lib/plexmediaserver/tmp_transcoding
this will be used as a temp dir for transcoding
/var/lib/plexmediaserver/Library/Application Support
This is where Plex will store all of the Metadata for your Media

To Use plex you really need the PI to be set to a static IP

To get your current Ip Address use

hostname -I

edit the cmdline.txt file

sudo nano /boot/cmdline.txt

At the bottom of the file ad the following line but replace Your IP with the IP Address you got from above

ip=Your IP

When done Use CTRL-X press Y and Enter to Save

Now reboot the PI

sudo reboot

when you have finished the install i would suggest you read the guides below as plex will use the SD Card a lot so a USB Drive will be better

How to Boot from USB on Raspberry PI
and
Copy the Sd card to USB Stick or drive and boot from USB Without the SD Card Inserted

When you have sorted the install onto a USB it would be wise to use a USB HDD for storing your media
This would be best served by using a self powered USB Drive as USB powered from the PI may cause Power instabilities.

See the guide below on

Mounting a USB Drive to a Raspberry PI

when you have your Plex server up and running you can now install the samba service if you want to copy the media onto the external hdd while connected to the PI over the network

Install Samba

sudo apt install -y samba samba-common-bin

you need to change the permissions of the directory you have mounted in the Mounting a USB Drive to a Raspberry PI guide above , we will use the /mnt/usbhdd as in that guide

sudo chmod -R 777 /mnt/usbhdd

Edit the Samba config file

sudo nano /etc/samba/smb.conf

copy the following into the editor

public = yes
only guest = yes
browseable = yes
read only = no
writeable = yes
create mask = 0644
directory mask = 0755
force create mask = 0644
force directory mask = 0755
force user = root
force group = root

I found The above will allow for sharing over any network

Restart the samba service

sudo systemctl restart smbd

Create a password for the share , ill use the default pi user but use whatever you login as

sudo smbpasswd -a pi

You will be prompted to enter the password twice (it can be the same as the one you use to login)

Then Added user pi. should appear

You should then be able to connect to the share over the network by using in windows
\\192.168.1.222 replacing the IP with yours
It should also ask for the Username and password you created .

Leave a Reply

Your email address will not be published. Required fields are marked *