loader

Install personnal home media server, Plex – Deluge (WebUI), on Ubuntu 16.04.1

Objective

 

The objective of this guide is to install a personal home media center for all family videos, Movies, etc.
Of course like most of us we acquire a lot of files through “torrents”.
I used to have a PC installed with Windows XP with simple share where I would open the files from another computer plugged in with HDMI to my TV and navigate with a wireless mouse and keyboard.
A few years back it was good, but as time goes on better solutions have been developed.

So lets upgrade our solution to something better, much better.

Here is a summary of all installation that I will cover in this guide.
For this installation I have also got inspired by other guides. I will add the references at the end.

Summary of installed software

 

OS: Ubuntu 16.04.1 LTS -> https://www.ubuntu.com/

Software:
TigerVNC server -> http://tigervnc.org/
xRDP -> http://www.xrdp.org/
SSH
Plex Media Server -> https://www.plex.tv/
Deluge BitTorrentClient -> http://deluge-torrent.org/
Samba -> https://www.samba.org/

Installation

System (installation)

 

For starters we will install Ubuntu Desktop 16.04.1. The installation itself is pretty vanilla, for almost all questions the default answers were taken. My PC is nothing special either.
I used a simple PC with 4 hard drives, 1x 120Gb and 3x 500Gb. I could have used a 1 or 2 Tb drives, but since I didn’t want to spend much money and already had the parts. Of course the HDD with 120Gb will be used for the OS.

Once the system is installed i recommend to update the full system:

CMD:  sudo apt-get update
CMD:  sudo apt-get upgrade
CMD:  sudo apt-get dist-upgrade

 

I would recommend doing a “reboot” as the “dist-upgrade” might install a newer version of the kernel.

SSH (installation)

 

This is simple, open a local console session and type the following command to install ssh. It will enable us to remote access via SSH protocol.

CMD: sudo apt-get install ssh

 

Remote Control (installation)

 

For this case I will be using a lot of the graphic interface. Like most Linux servers I build, they are no graphical interface and I purely use SSH remote access.
But in this case I will use it, but I would like to use a remote access.
For a long time I used to use VNC but ran in a lot of problems, specialy the idea of one password protection didnt appeal to me.
Also I’m a Windows OS user at home at work were 80% of servers are Windows, so Remote Desktop is what I use most of the time.

Now I will show you how to use the standard Microsoft Remote Desktop Client on an Ubuntu server.

The solution is a combination of TigerVNC Server and xRDP.
Lets go on the site: http://tigervnc.org/
Go on -> Releases -> follow the link for available binary. -> Go to Files.

Find the “ubuntu-16.04LTS” folder than “amd64” download the file:
“tigervncserver_1.7.1-1ubuntu1_amd64.deb”

Here is a direct link for version 1.7.1: Link

CMD: sudo apt-get install libtasn1-3-bin
CMD: sudo dpkg -i tigervncserver_1.7.1-1ubuntu1_amd64.deb
CMD: sudo apt-get install xrdp -y

 

Plex Media Server (installation)

 

https://downloads.plex.tv/plex-media-server/1.3.4.3285-b46e0ea/plexmediaserver_1.3.4.3285-b46e0ea_amd64.deb

CMD: sudo dpkg -i plexmediaserver_1.3.4.3285-b46e0ea_amd64.deb 
CMD: sudo systemctl status plexmediaserver

 

Samba (installation)

 

You know it’s always a good thing to have a few shared folders to help with files transfers. So let’s install Samba on our system.

CMD: sudo apt-get install -y samba samba-common python-glade2 system-config-samba

 

Deluge Torrent Client (installation)

 

Now we are going to install the deluge web torrent client. This installation is a little bit more manual.

We are going to create a special user called “deluge”, after create some log files for it.

CMD: sudo adduser --disabled-password --system --home /var/lib/deluge --gecos "Deluge service" --group deluge
CMD: sudo touch /var/log/deluged.log
CMD: sudo touch /var/log/deluge-web.log
CMD: sudo chown deluge:deluge /var/log/deluge*

We are going to install deluged and deluge web UI now.

CMD: sudo apt-get install deluged deluge-webui -y

Configuration

 

Just to make sure that they are no dependencies missing

CMD: sudo apt-get install -f

 

Remote Control (Configuration)

 

Now lets configure our Linux system so that we can use Microsoft “Remote Desktop Client” to access our system.

We will now specify which desktop to start while connected through xRDP session.

CMD: cd
CMD: echo unity>~/.xsession
CMD: nano .xsession
add the following text before "unity"
****
/usr/lib/gnome-session/gnome-session-binary --session=ubuntu &
/usr/lib/x86_64-linux-gnu/unity/unity-panel-service &
/usr/lib/unity-settings-daemon/unity-settings-daemon &

for indicator in /usr/lib/x86_64-linux-gnu/indicator-*; 
do
  basename=`basename ${indicator}`
  dirname=`dirname ${indicator}`
  service=${dirname}/${basename}/${basename}-service
  ${service} &
done
****

Now we need to configure the xrdp keyboard settings

CMD: cd /etc/xrdp
CMD: setxkbmap -query | awk -F":" '/layout/ {print $2}'
CMD: setxkbmap -layout (the result of the previous CMD)
CMD: sudo cp /etc/xrdp/km-0409.ini /etc/xrdp/km-0409.ini.bak
CMD: sudo xrdp-genkeymap km-0409.ini

 

Deluged (Configuration)

 

Let’s configure the Deluge Daemon service for automatic startup.

CMD: sudo nano /etc/systemd/system/deluged.service
Add the following text.
****
[Unit]
Description=Deluge Bittorrent Client Daemon
After=network-online.target

[Service]
Type=simple
User=deluge
Group=deluge
UMask=000

ExecStart=/usr/bin/deluged -d

Restart=on-failure

# Configures the time to wait before service is stopped forcefully.
TimeoutStopSec=300

[Install]
WantedBy=multi-user.target
****

Now let’s configure the Deluge Web interface for automatic startup.

CMD: sudo nano /etc/systemd/system/deluge-web.service
Add the following text.
****
[Unit]
Description=Deluge Bittorrent Client Web Interface
After=network-online.target

[Service]
Type=simple

User=deluge
Group=deluge
UMask=027

ExecStart=/usr/bin/deluge-web

Restart=on-failure

[Install]
WantedBy=multi-user.target

Now lets start both the Deluge Daemon and Web interface.

CMD: sudo systemctl start deluged
CMD: sudo systemctl enable deluged
CMD: sudo systemctl start deluge-web
CMD: sudo systemctl enable deluge-web

To make sure it works, I recommend a reboot to make sure it starts up correctly. After the reboot, open a web browser and the host address IP or FQDN with the port 8112. http://plexmedia:8112 the default password is “deluge”.

Access PlexMedia

 

At this point plex media is installed and all configurations will be done via there web interface. To access open a web browser and the host address IP or FQDN with the port 32400 and folder “web”. http://plexmedia:32400/web Take note that yes you have to create a plex account but it’s free when you are using it for home and personnal use.