Using Plex Media Server on a Raspberry PI 3

I am currently experimenting to create a cheap Plex Media Server running on a Raspberry Pi 3!

I am aiming to share my media to my chromecast and my smartphone. So that I can play my music everywhere or turn off my PC when watching a TV Show.

I followed this guide:  https://www.element14.com/community/community/raspberry-pi/raspberrypi_projects/blog/2016/03/11/a-more-powerful-plex-media-server-using-raspberry-pi-3.

Install Raspbian

Raspbian is easily installed! Download the latest lite version: https://www.raspberrypi.org/downloads/raspbian/.

On windows, I prefer Etcher to burn the image on an SD card This may help you if you don’t know how to do it.

After loading the image, connect your usb keyboard and hdmi monitor so you can get started with your Pi 3! Now connect the power and see it boot up!

SSH not working?

Already twice I’ve experienced SSH not working with a Connection refused exception in putty.

The problems lies with the host certificate used for ssh and the solution is to remove them and generate them again:

sudo rm /etc/ssh/ssh_host_* && sudo dpkg-reconfigure openssh-server

Ntfs

To use ntfs usb stick I had to install ntfs-3g:

sudo apt-get install ntfs-3g

Then I could use ntfs-3g as a type:

Spin down the hard disk

I tried this guide but unfortunately my old external hard drive doesn’t really support spinning down. I am also not certain if it really ads value.

Let’s install Plex!

Best to begin with updating your Raspbian installation!

sudo apt-get update && sudo apt-get upgrade -y
sudo apt-get update && sudo apt-get dist-upgrade

Install Plex:

sudo apt-get install apt-transport-https -y --force-yes
wget -O - https://dev2day.de/pms/dev2day-pms.gpg.key | sudo apt-key add -
echo "deb https://dev2day.de/pms/ jessie main" | sudo tee /etc/apt/sources.list.d/pms.list
sudo apt-get update
sudo apt-get install -t jessie plexmediaserver -y

Now restart your PI:

sudo reboot

After figuring out your ip, you should be also to surf to Plex: 192.168.0.3:32400/web and register your new server!

Sources

Raspbian cheat sheet

My own cheat sheet for commands I often use. It’s a work in progress.

See CPU Temperature
/opt/vc/bin/vcgencmd measure_temp
List hard disks
sudo blkid
Reboot
sudo reboot -n
Shutdown
sudo shutdown -h now
Upgrade your installed packages
sudo apt-get update
sudo apt-get upgrade
See available disk space
df -h

Mount a usb drive or hard disk on Raspbian

What’s the best way to auto mount a usb drive or hard disk? What if the filesystem is ntfs?

To get a list of connected usb disks you can:

sudo blkid

In the screenshot above you can see there are two usb devices:

  • /dev/sda1: UUID=”E89484EA9484BC96″ TYPE=”ntfs” PARTUUID=”008ffb75-01″
  • /dev/sdb1: LABEL=”Extern station” UUID=”92FA278AFA2769A5″ TYPE=”ntfs” PARTUUID=” 0009a8db-01″

To be able to use these devices, you have to mount them in a folder. Let’s create two folders:

sudo mkdir /mnt/usb1
sudo mkdir /mnt/hd1

The usb1 folder I’ve created for my usb stick. The hd1 folder for my external hard drive.

We need to take ownership of these folders:

sudo chown -R pi:pi /mnt/usb1
sudo chown -R pi:pi /mnt/hd1

If any of the usb devices is formatted in ntfs, you best install ntfs-3g:

sudo apt-get install ntfs-3g

Now let’s edit our file system table, so that the usb stick & external hard drive are mounted every time the system boots:

sudo nano /etc/fstab

As you can see in the screenshot above I’ve used the disk UUID as name to find it. This way, if you unplug your usb flash drive and put it in another usb port, it still works. As type, make sure to use ntfs-3g.

Now you just need to reboot and the disks are both mounted!

sudo reboot

For completeness, you could also mount the usb stick just once with this:

sudo mount -o uid=pi -o gid=pi -t ntfs-3g /dev/sda1 /mnt/usb1

Sources