Hi folks,
I recently switched my Plex Media Server from a shared Mac onto a dedicated Intel NUC running Ubuntu. The new server has been running perfectly for a few weeks now so I thought I would document the process I went through, just in case it helps anyone else.
USAGE
In our household we have a dedicated client machine running OpenELEC+PlexHomeTheater and all our media stored on a NAS drive, with gigabit ethernet throughout. Most Plex usage is playing media in PlexHomeTheater but we also use the iOS app on several iPads for both viewing media and controlling playback on the main client.
HARDWARE
- Intel Core i5 NUC (D54250WYKH)
- 16GB DDR3-1600MHz RAM (1.35 volt)
- 256GB mSATA SSD
- Insert RAM
- Insert mSATA card
- Update BIOS with latest from Intel's website
- Configure BIOS (date, time, enable LAN, auto power on after a power loss)
- Make bootable USB drive from Ubuntu Server 14.04 LTS .iso file using unetbootin
- Boot from USB and install Ubuntu Server 14.04 LTS
- Reboot and login as your system user (created during the installation)
- Enable Trim on root filesystem
sudo tune2fs -o discard /dev/sda3 [CHANGE TO SUIT YOUR PARTITION NUMBER]
- Update system
sudo apt-get update sudo apt-get -f install
- Assign the NUC a static IP address in your router's DHCP configuration (just makes it easier to find later if it always has the same local IP address)
- Create mount point for Drobo NAS
sudo mkdir /mnt/Drobo-0
- Add Drobo NAS to /etc/fstab file
sudo nano /etc/fstab //192.168.0.200/Media /mnt/Drobo-0 cifs username=plex,password=xxxxxxxx 0 0
- Install Plex Media Server
cd ~ wget http://downloads.plexapp.com/plex-media-server/0.9.9.7.429-f80a8d6/plexmediaserver_0.9.9.7.429-f80a8d6_amd64.deb sudo dpkg -i plexmediaserver_0.9.9.7.429-f80a8d6_amd64.deb
- If you get errors about package dependencies try the following commands before rerunning the dpkg command shown above
sudo apt-get update sudo apt-get -f install
- Install iStatd server
sudo apt-get install checkinstall sudo apt-get install git sudo apt-get install automake cd ~ git clone https://github.com/tiwilliam/istatd.git cd istatd sh autogen ./configure --sysconfdir=/etc make sudo make install sudo useradd istat sudo mkdir -p /var/{run,cache}/istat sudo chown istat.istat /var/{run,cache}/istat sudo nano /etc/istat.conf
- Configure istatd server for upstart
sudo nano /etc/init/istat.conf
- Below is the contents of my /etc/init/istat.conf you can see that I have added a pre-start section to give my NAS drive time to mount properly, otherwise iStat server will not show it
# istat - service job file description "istat" # Start the iStat server after network and filesystem start on runlevel [2345] and filesystem and net-device-up IFACE!=lo # When to stop the service stop on runlevel [016] # Automatically restart process if crashed respawn respawn limit 10 30 # Check dependencies pre-start script LOG_FILE=/tmp/istatd_upstart.log echo "Executing istat pre-start script" > $LOG_FILE # Check that istatd exists and is executable echo "Checking execute permisissions on istatd" >> $LOG_FILE test -x /usr/local/bin/istatd || { stop; exit 0; } # Check that istatd config file and runtime directories exist echo "Checking for config file" >> $LOG_FILE test -f /etc/istat.conf || { stop; exit 0; } echo "Checking for runtime directories" >> $LOG_FILE test -d /var/cache/istat || { stop; exit 0; } # Wait for Drobo-0 to mount echo "Checking that Drobo-0 is mounted" >> $LOG_FILE TIMEOUT=10 # 10 second timeout - each iteration sleeps for 1 second DIR="/mnt/Drobo-0" until [ $TIMEOUT -eq 0 ]; do if [ "$(ls -A $DIR)" ]; then echo "Detected Drobo-0 mounted successfully" >> $LOG_FILE exit 0; fi TIMEOUT=$((TIMEOUT-1)) echo "Waiting for Drobo-0 to mount" >> $LOG_FILE sleep 1 done echo "Timeout waiting for Drobo-0 to mount" >> $LOG_FILE exit 0; end script # What to execute exec /usr/local/bin/istatd
- Start istat service
sudo service istat start
- Test the iStat server now by running the iStat app on your iPhone or iPad
sudo apt-get install samba system-config-samba cifs-utils winbind sudo mkdir /mnt/Update sudo chown myuser:myuser /mnt/Update
sudo nano /etc/samba/smb.conf
- Here is my /etc/samba/smb.conf
[Update] path = /mnt/Update comment = Update Storage writeable = Yes browseable = Yes guest ok = Yes force user = myuser
STEP 8: Configure firewall
I wanted to have some basic level of security on the server, so I turned on the firewall and opened up the ports I needed (SSH:22, iStat:5109, PMS:32400)
sudo ufw reset sudo ufw allow ssh sudo ufw allow samba sudo ufw allow 5109/tcp ... add Plex port numbers here - see link above ... sudo ufw allow 32400/tcp sudo ufw allow 32443/tcp sudo ufw allow 32469/tcp sudo ufw allow 1900/udp sudo ufw allow 5353/udp sudo ufw allow 32410/udp sudo ufw allow 32412/udp sudo ufw allow 32413/udp sudo ufw allow 32414/udp sudo ufw enable
- Make sure that wherever your media files are stored is accessible by the local "plex" user/group
- Visit Plex server in web browser (in my case http://192.168.0.100:32400/web)
- Follow the prompts to perform first-time setup of the Plex Media Server
- Setup your media sections (Movies, TV Shows)
- Wait for media scanning to complete, correct any mis-matches
- Add your Channels
- Test PMS web interface
- Test PMS access from clients (Plex Home Theater, iOS, Android, etc)
- Schedule weekly reboot (all machines need a reboot occasionally, having it scheduled means that I can forget about it and the machine just works!)
sudo crontab -e # Uncomment whatever option you prefer for weekly or monthly reboots # # Reboot at 04:00 on the 1st day of every month # 0 4 1 * * /sbin/reboot # # Reboot at 04:00 every Sunday # 0 4 * * 0 /sbin/reboot
OUTCOME
Hopefully at the end of all that you will have a very small, quiet, well-behaved Plex Media Server that should be fairly easy to monitor and look after.
Installing updates to the Plex Media Server should just involve downloading the latest .deb package from the Plex website and rerunning the dpkg command again.
I hope that helps anyone else attempting to run PMS on Ubuntu.
If anyone has any other tips or suggestions for running a stable PMS please do post them.