Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shawnthompson/c9a2dc326d19ce5af87d5c2319f908be to your computer and use it in GitHub Desktop.
Save shawnthompson/c9a2dc326d19ce5af87d5c2319f908be to your computer and use it in GitHub Desktop.
Guide for getting Plex, SickRage, CouchPotato, Transmission, PlexPY, OpenVPN (PIA) up and running on dual rpi's or headless ubuntu

Setup guide for

  • DD-WRT router flash software
  • VPN on router (PIA)
  • Static IPs for NAS and rpi3(plex/tra)
  • UPnP and port forwarding - TO BE REVISED (is UPnP secure?)
  • Ubuntu install
  • Install Plex Media Server on ubuplex
  • rpi3(plex/tra) with fresh install
  • Install Plex Media Server on rpi3plex
    • Mount NAS drives to rpi3(plex/tra) or ubuplex
  • Plex Media server (rpi3plex)
  • CouchPotato (rpi3plex)
  • SickRage (rpi3plex)
  • PlexPY (Ubuntu)
  • Install OpenVPN on rpi3tra
  • Transmission (rpi3tra)
  • Backup rpi3(plex/tra) SD card

DD-WRT router

Info : It's not necessary to flash your router to DD-WRT if your current router is fine. I flashed mine since I could turn on the OpenVPN client to switch devices that don't have built in VPN capabilities like the Roku.

Start by Googling DD-WRT with router name to find if compatible. If so then follow guide to flash router with new DD-WRT software.

Mine : https://www.dd-wrt.com/wiki/index.php/Netgear_R6300

Follow setup guide and wifi setup. Change default password. Set secure wifi passwords.

Backup DD-WRT config file.

Setup VPN on router (PIA)

PIA setup with DD-WRT is here : https://www.privateinternetaccess.com/pages/client-support/dd-wrt-openvpn

Some changes to the guide. Don't use the DNS name (us-east.privateinternetaccess.com) for the server use the IP (209.222.23.62 at the time, re-check). Also reduce MTU to 1400.

Backup DD-WRT config file.

For now disable OpenVPN since we're not downloading torrents yet. Also this is only for specific situations, see note above. We'll be setting up "transmission" to use PIA directly.

Setup static IPs for NAS and rpi3

Login to router and go to Status > LAN. Note down the MAC address for rpi3 and NAS.

Follow guide here : https://www.dd-wrt.com/wiki/index.php/Static_DHCP

  • MBLD-STRG - 00:90:A9:BD:54:76 - 192.168.1.50
  • rpi3plex - B8:27:EB:FE:30:4D - 192.168.1.75
  • rpi1tra - B8:27:EB:46:3F:A9 - 192.168.1.80
  • ubuplex - 4C:CC:6A:D2:52:C1 - 192.168.1.25 (don't need this if using rpi3, don't need rpi3 if using this)

Router reboot should not be required. Have your device reboot should force router to assign new IP.

UPnP and port forwarding

Also while we're in the router we may as well activate the port forwarding and UPnP settings. The UPnP settings can be found under "NAT / QoS > UPnP". Simply enable the UPnP and Save / Apply settings.

For port forwarding go to "NAT / QoS > Port Forwarding". We'll need to add 4 entries in this section for SickRage, CouchPotato, Plex and Transmission. This will allow us to remotely access our software so we can do stuff while not at home. It's important that all 4 services are password protected otherwise bad shit will happen! DO NOT use auto-login or no-login on any of these services. I repeat, BAD SHIT WILL HAPPEN if you do!

So to setup click "Add" and then this is the format:

Application - Doesn't matter the name, it's for you to know what this one is.

Protocol - Select "Both"

Source Net - Leave empty

Port from - SickRage = 8081 / CouchPotato = 5050 / Plex = 32400 / Transmission = 51413

IP address - SickRage / CouchPotato and Plex all use 192.168.1.75 (or .25 for ubuplex) / Transmission will use 192.168.1.80

Port to - Same as Port from

Enable - Checked

Good to go, we can make sure these are working later by testing from a remote location. You can grab your current IP from https://www.whatismyip.com/ which I bookmarked in FF and from work I can put in the IP using the port and voilà, remote access!

Backup DD-WRT config file.

Ubuntu install

This section is for the Ubuntu install if you're using that instead of the rpi3. I purchased a headless ubuntu box at Canada Computers for 500$. The CPU is the most important part, only need 8GB of memory and get an SSD HDD. Any shit video card will do because it's only for the setup anyway. Get heat sink for the CPU so you don't hear the fan.

Issues? Yes :-( For some reason the install guide sucks if it doesn't have a CD-ROM. Took me an hour to figure out that my mouse plugged in was causing issues (don't need a mouse anyway). Also check this (https://askubuntu.com/questions/593002/fail-to-install-ubuntu-server-14-04-64bit-lts-from-usb-drive), I plugged my USB key into the same port that had the mouse and suddenly it worked.

Make sure you don't forget your superuser login/password otherwise I think you're SOL.

Install Plex Media Server on ubuplex

Follow guide here : https://www.htpcguides.com/install-plex-media-server-ubuntu-16-x-and-later/

Alternate guide : https://www.linode.com/docs/applications/media-servers/install-plex-media-server-on-ubuntu-16-04

On the HTPC guide switch the first steps for the ones in the linode guide:

wget https://downloads.plex.tv/plex-media-server/1.5.6.3790-4613ce077/plexmediaserver_1.5.6.3790-4613ce077_amd64.deb (check the URL on Plex downloads for the latest version). sudo dpkg -i plexmediaserver*.deb sudo systemctl enable plexmediaserver.service

Now continue on HTPC guide from "Fix Plex Permission Issues". To fix permissions use Option 2 but I run as root/root.

Check the Plex local URL to see if it worked.

rpi3(plex/tra) with fresh install

Follow guide here : https://pimylifeup.com/noobs-raspberry-pi/ Alternate guide : http://lifehacker.com/the-always-up-to-date-guide-to-setting-up-your-raspberr-1781419054

Next we need rpi3 to boot to command line instead of GUI and set gpu_mem to 16 and GUI is not needed.

Follow guide here : https://www.modmypi.com/blog/boot-to-command-line-raspbian-jessie

Also enable SSH access before rebooting and set correct locales.

The Raspberry Pi default login for Raspbian is username pi with the password raspberry. CHANGE PASSWORD!

Install Plex Media Server on rpi3plex

Login to rpi3plex now using SSH on port 22. Now that raspbian is installed we need to install Plex Media Server.

Follow guide here : https://pimylifeup.com/raspberry-pi-plex-server/

Mount NAS drives to rpi3(plex/tra) or ubuplex

First we need to install ntfs-3g. Then we need to install cifs-utils.

Follow guide here : https://pimylifeup.com/raspberry-pi-nas/ (install ntfs-3g only then continue from this guide)

Now run sudo apt-get install cifs-utils (make sure it's up to date).

Now run this command for making directory sudo mkdir /mnt/plexnas.

Now let's edit fstab so it automounts when booting up. This is what is required in /etc/fstab (sudo nano /etc/fstab), follow guide here : https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=22957 (see post by lewmur » Thu Nov 15, 2012 4:37 pm)

  • //192.168.1.50/FLMOVIES /mnt/plexnas/movies cifs guest 0 0
  • //192.168.1.50/KIDSMOVIES /mnt/plexnas/kidsmovies cifs guest 0 0
  • //192.168.1.50/FLTVSHOWS /mnt/plexnas/tvshows cifs guest 0 0
  • //192.168.1.50/FLDOWNLOADS /mnt/plexnas/downloads cifs guest 0 0

Now we need to edit raspi-config. The reason is that /etc/fstab will run before network is ready and drives will not be auto-mounted. To manually mount you can use command sudo mount -a. To avoid this be sure that the network is ready during the boot, there is an option Wait for Network at Boot in raspi-config.

Now run sudo raspi-config to get to raspberry configuration.

Set the Wait for Network at Boot option to Slow wait for network connection before completing boot and reboot. Of course the boot up time may well be affected but if that's not critical, this method can be used.

Now we need to reboot so run sudo reboot

Now test Plex Media Server by going to : 192.168.1.100:32400/web/

Plex Media server

Now that we can access Plex Media Server (PMS) we can do the initial configuration. Change the name (rlambert27-rpi3plex).

Now add libraries. I used (Movies, Kids movies, Films français, TV shows, Séries télé, Documentaries and Cartoons). Always keep english and french in different folders so you can add to Plex in correct language.

Depending on how much stuff you have to add this is a good time for a break while Plex scans and catalogs everything.

If you had friends in your account you'll need to go update their account to share your libraries.

CouchPotato

CouchPotato is strictly used to "snatch" movie torrents and send them to transmission for download.

Follow guide here : https://www.htpcguides.com/install-couchpotato-raspberry-pi-raspbian/

IF USING RPI3

When you run sudo pip install lxml cryptography pyopenssl it seems to hang, so you don't put lxml. I read that the cursor will idle when finished. I waited about 10 minutes and then hit Ctrl + Z and kept going with the guide. In the guide when it says to make pi the owner i'm running it as root instead so I don't run into permission issues on the NAS mounted drives.

For lxml install you can run sudo apt-get install python-lxml instead, instructions are here : http://lxml.de/installation.html.

Also once done run this command ` sudo pip install pyopenssl --upgrade`` to upgrade to the latest version. For some reason when installing using the guide it doesn't get the latest version.

IF USING UBUNTU

Don't install any packages, they should all be installed by default.

Now test CouchPotato by going to : 192.168.1.75:5050/home/

You can now login and go through all the configuration options.

At this point i'm doing an SD card backup. You know just in case! Follow this guide : http://lifehacker.com/how-to-clone-your-raspberry-pi-sd-card-for-super-easy-r-1261113524

SickRage

SickRage is strictly use to "snatch" TV torrents and send them to transmission for download.

Follow guide here (rpi3) : https://www.htpcguides.com/install-sickrage-raspberry-pi-usenet-torrent-tv/ Follow guide here (ubuntu) : https://github.com/SickRage/SickRage/wiki/Sickrage-installation-Debian-Ubuntu-14-15-16

On Ubuntu you need to install the packages first before running the auto-script, otherwise the guide works great!

For rpi3 install when you run wget http://sourceforge.net/projects/bananapi/files/unrar_5.2.6-1_armhf.deb put sudo in front otherwise it might not work.7

PlexPY (Ubuntu)

I did this on rpi3 but don't remember which guide I used, I forgot to update this guide. It should be the same as the Ubuntu one though:

Follow guide here (ubuntu) : https://www.htpcguides.com/install-plexpy-ubuntu-plex-monitoring/

Install OpenVPN on rpi3tra (p9087814)

Now on the rpi3tra we need to install OpenVPN and PIA. I'm using a wired connection. I first tried to use a WiFi setup but I had to format eveyrthing and start over. I'm assuming the guides only work with wired setups. Follow guide here : https://www.htpcguides.com/autoconnect-private-internet-access-vpn-boot-linux/

Small difference is to rename the US East.ovpn to USEast.ovpn file. Also I had to manually update /etc/resolv.conf and /etc/openvpn/update-resolv-conf files with the PIA nameservers and the third option as a Google DNS:

  • /etc/openvpn/update-resolv-conf file:
  • foreign_option_1='dhcp-option DNS 209.222.18.222'
  • foreign_option_2='dhcp-option DNS 209.222.18.218'
  • foreign_option_3='dhcp-option DNS 8.8.8.8'
/etc/resolv.conf file:
# Generated by resolvconf
nameserver 209.222.18.222
nameserver 209.222.18.218

In the USEast.ovpn file don't use us-east.privateinternetaccess.com, use the IP instead. Ping the server and use the IP. If I used us-east.privateinternetaccess.com my OpenVPN service would not start. I should eventually investigate why!

To test your IP you can use the following command : curl ipecho.net/plain; echo

Alternate guide that may work but untested: https://gist.github.com/superjamie/ac55b6d2c080582a3e64

Transmission (rpi3tra)

Transmission is used to download all the torrents behind the PIA VPN installed in the previous step.

Follow guide here : https://www.htpcguides.com/install-transmission-bittorrent-client-on-ubuntu-15-x/

I had to follow the section called "Fix Transmission Permission Issues with systemd" otherwise I was getting permission denied errors.

Once everything is setup you can check what your transmission is exposing as an IP by going to : https://ipleak.net/ (follow the instructions in section "Torrent Address detection").

Backup rpi3 SD card

Now, everything is great! How many hours did you spend on this? The first time I did this I must have spent over 20-25 hours getting everything working correctly. Don't make this wasted time by not backing up your SD card.

Follow guide here : http://lifehacker.com/how-to-clone-your-raspberry-pi-sd-card-for-super-easy-r-1261113524

If anything happens or SD card becomes corrupted you've got a clean install ready to go! Although I haven't had to do this yet i'm not sure if the MAC addresses will stay the same, they might change so you may need to update router with new MAC addresses.

Useful linux commands for rpi's

I use the software putty to SSH into the rpi's, here are some basic / useful commands

  • ls / cd / mkdir / rmdir / rm / cp / mv (these you should know, if not go google some shit)
  • sudo (run a command as a superuser, this is done most of the time in my guides)
  • free -m (check current memory usage, free memory might be low but this is unimportant, see (https://raspberrypi.stackexchange.com/questions/37913/freeing-up-cache-when-memory-is-low))
  • top (check the top current running executables)
  • curl ipecho.net/plain; echo (check your current public IP)
  • ip addr show (show current network interface IPs, usually on eth0, wlan0 is your wifi)
  • ping (duh!)
  • cat (file name) (show the contents of a file)
  • chown (change the user/group ownership of a file)
  • unzip (duh!)
  • wget (download a file from the web)
  • grep (used for search, ex: grep "openvpn" *.txt)
  • exit (log out of SSH)
  • lsb_release -a (check your Ubuntu version)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment