Plex Media Server From Scratch

How to set up a Plex Media Server on Debian 9 from scratch!

Plex Media Server From Scratch

So... I have built a million of these things and I figured it's finally about time I document what I had to do to get it running. I am mainly writing this because I encountered a ton of little issues that slowed me down enough that I hope to help someone else.


Background:

I have been running a Plex media server for about 10 years now, and the most recent one is showing its age. Here are the specs of the server itself:

OLD Server Specs:
  • Old HP Desktop
  • Pentium Dual-Core 2.6Ghz
  • 4gb ram
  • 80gb Primary Platter Drive
  • 4Tb Media Drive
NEW Server Specs:
  • Dell OptiPlex 9020
  • Intel(R) Core(TM) i5-4570 CPU @ 3.20GHz
  • 16gb ram
  • 250gb 10k RPM Primary Platter Drive (replaced)
  • 250gb OCZ SSD Primary Drive
  • 250gb 10k RPM Secondary Platter Drive (replaced)
  • 4tb Data Drive (Seagate IronWolf)
  • 4tb Media Drive (WD Red)
Server OS & Apps
  • (OLD) Ubuntu Server 16.04
  • (NEW) Debian Jesse 8
  • Plex Media Server
  • SABNZBD+
  • Sonarr
  • PlexPy
  • Webmin
  • Apache Webserver
  • Ventrilo (unused)
  • Misc. Backup & Maintenance Scripts

Usage Topology:

This server is ONLY used by myself or my immediate family. The performance and statistics are made with the idea of between 1 and 4 streams active at any given time. Here is the network and client breakdown:

  • 2x Apple TV's Gen 4 (Hardwired)
  • 1x Chromecast 2nd Gen (5ghz Wifi)
  • 1x Roku XS Gen 2 (Hardwired)
  • 1x Roku TV Gen 4 (5ghz Wifi)
  • Multiple Android & iOS Tablets & Phones (5ghz Wifi)
  • Multiple Computers (Some wired, some wifi)

Part 1: Installing the OS

So Debian appeared to be a giant pain in the butt to get running. This was mainly sue to the fact that I am on a Mac and all of the instructions for making a bootable USB drive on it call for using UnetBootIn and apparently it doesn't work right any more and resulting usb keys won't boot. I ended up making the drive off of my Windows 10 laptop using XXXX which worked first try.

I followed all of the basic installation instructions except that I did not install a GUI. Because this server largely runs headless, I don't need a GUI.

Part 2: Configuring the base user

The installation process will have you set the root password and then create a new user. The catch that they don't really explain to you is that the user you created cannot SUDO, so you have to configure that.

  • Step 1: Log into the server and switch user to the root user by typing su. You will be prompted to type in the root password that you set during install.
  • Step 2: Type the following command visudo. You will be taken to a text editor interface.
  • Step 3: Find the line that looks like this (without the red) and then add the red line just below it. Substitute out the newuser piece with the username of the account that you are giving permission to:
    ``` # User privilege specification root ALL=(ALL:ALL) ALL ``` Now add the following just below that (change "newuser" to the username of the account you wish to give permission to): ``` newuser ALL=(ALL:ALL) ALL ``` Hit `Ctrl+X` to exit and it will ask if you wish to save your changes. Say yes and leave the filename the same (hit enter).

Part 2a: Installing Emacs

So I'm not a VI or Nano person, so I need to install Emacs as it is not installed by default. You can skip this if you are ok with what is pre-installed. To install emacs, type the following commands:

sudo apt update
sudo apt install emacs24

Part 3: Configuring the Network

This is pretty easy, but if you haven't done it via command-line before, it's tough to fathom. If you are using a desktop GUI (Gnome, XFCE, etc.), you can just make the change using that. I however am running with CLI only (headless), so the configuration of this is done in config files.

Note: During install, you can manually specify the IP info which will generate the files for you.

File: /etc/networking/interfaces

Layout:

Comment out everything else in this file. You only need the contents that are specified below. Be sure to update the data with the info specific to your network.

source /etc/network/interfaces.d/*
auto lo
iface lo inet loopback

allow-hotplug eth0

auto eth0
iface eth0 inet static
      address 10.0.0.10
      netmask 255.255.0.0
      gateway 10.0.0.1

DNS is managed in the /etc/resolv.conf file. If you look at the layout, it's pretty self explanatory.


Be sure to install in UEFI mode WITHOUT LVM (at least that's the only way I got it working).


Webmin

This is not required, though it a nice way to manage the system from a web browser. Skip this is you are comfortable with the command prompt through ssh... which you should be by the time you are done here.

  • download package from webmin site
  • sudo dpkg -i package.deb Will fail due to prereq's.
  • sudo apt -f install to install prereq's.
  • access it at https://10.0.0.10:10000. Standard cert errors will be present, but assume it is safe.

Plex Media Server

  • download package from plex.tv
  • sudo dpkg -i package.deb
  • watch for errors.
  • after install access it at http://10.0.0.10:32400/web/

Do plex setup things. This is a standard install, so I'm not going to touch the specifics here. I will cover the specifics of that in a later article.


SABNZBD+


Sonarr (nzbdrone)


PlexPy


Conclusion

This is a living document that I will update as things change or I feel like adding more in. I have had absolutely 0 (zero) problems with plex itself, including communication or the function with browsing/playing through clients. The only issues that did arise were either disk errors (blew a platter on a previous drive, ran out of space on a partition due to screwing up the original partition layout.

If you have any comments, changes or questions, please let me know. You can reach me at comments@cmivxx.com.

Related Article