Skip to content

Instantly share code, notes, and snippets.

@mitchellurgero
Last active March 6, 2018 18:59
Show Gist options
  • Save mitchellurgero/ca304249b0016c53b96436c513a597c2 to your computer and use it in GitHub Desktop.
Save mitchellurgero/ca304249b0016c53b96436c513a597c2 to your computer and use it in GitHub Desktop.
[HOWTO] Open Source Media Center (RPI / x86)

Media Center Setup for Linux arm/x64 computers

Table of Contents

Explination of Tutorial

This tutorial does assume that you know at least a little bit of linux. I am also assuming that you are on Ubuntu 17.04+ or Debian 9. Other Linux distros will work, however other distros might require different steps completely. So use this at your own risk.

In this tutorial we will be installing quite a few different services and applications on linux to turn your computer into a complete media center where you will be able to do DVD, Movie, Music, and gaming(emulators) all in one box. This includes setting up web interfaces for some of those as well as a way to access the hard drive on the machine remotely for convenience.

Things to be installed in this tutorial(These will be installed via apt, no need to download them):

  • qBittorrent / qbittorrent-nox (For Torrent Web Interface)
  • Subsonic (For Movie and Music playback remotely)
  • Kodi (For DVD, Movie, and music playback locally)
  • RetroArch (With the XMB theme, for emulator/game playback locally)
  • NoMachine (For Remote application management if needed)
  • SSH (For remote system management if needed)
  • Samba Server (For remote hard drive viewing and editing)
  • OpenVPN Server (For remote access)
  • UFW (To easily secure the media center)

When all is said and done, you will have the ultimate media center for yourself, family, etc that supports almost anything you through at it! (And up to 5 players locally for games)

Requirements

  • Desktop (Or Raspberry Pi) with Ubuntu 17.04 OR Debian 9)
  • I'd recommend 500GB HDD, but anything over 32GB should be enough for small servers
  • Basic understanding of Linux
  • Internet Access (Even if temporary) on the target server

Installing all the things

OK So this will pretty much be a step-by-step tutorial. Any explination that should be required, will be here, but it will be minimal as it is quite a long process.

**To simplify the install process, these commands will ASSUME the use of sudo.

Setting up SSH and installing updates

  1. First things first, update the OS: sudo apt update && sudo apt upgrade
  2. We are going to start with ssh, so make sure it is installed: sudo apt install ssh
  3. Then with that done, we can move to a more convenient computer and login via SSH.

Setting up qBittorrent with Web Interface

  1. Install: sudo apt install qbittorrent qbittorrent-nox
  2. Now we need to setup the web interface in a service file: sudo nano /etc/systemd/system/qbittorrent.service and then add the following to it:
[Unit]
Description=qBittorrent Daemon Service
After=network.target

[Service]
User=<your_username>
Group=<your_username>
PIDFile=/home/<your_username>/qbittorrent.pid
ExecStart=/usr/bin/qbittorrent-nox --webui-port=8081
ExecStop=/bin/kill -HUP $MAINPID
Restart=always
RestartSec=3
[Install]
WantedBy=multi-user.target
  1. Let's enable the service: sudo systemctl enable qbittorrent.service
  2. Before we start the service, on the desktop, make sure to run the program at least once, then: sudo systemctl start qbittorrent.service
  3. At this point, just test and make sure you can login to it, if you cannot, please go onto the desktop, and configure qBittorrent to have a username and password (This is best to secure it!!!!) in the Options.

Subsonic Install and Configuration

  1. First, we will need to download subsonic: wget https://s3-eu-west-1.amazonaws.com/subsonic-public/download/subsonic-6.1.1.deb (NOTE: there might be a newer version than the one in this tutorial!! Please check their website for an up-to-date link first!)
  2. Then: sudo dpkg -i subsonic-x.x.x.deb (Change file name to downloaded one of course!) If it fails: sudo apt-get install -f to finish.
  3. Now we need to modify subsonic's default configuration: sudo nano /etc/default/subsonic and change to mimic:
SUBSONIC_ARGS="--max-memory=512 --port=8080 --https-port=4433"


# The user which should run the Subsonic process. Default "root".
# Note that non-root users are by default not allowed to use ports
# below 1024. Also make sure to grant the user write permissions in
# the music directories, otherwise changing album art and tags will fail.

SUBSONIC_USER=<your_username>
  1. Once that is done, restart the service: sudo systemctl restart subsonic.service

Kodi Install

  1. This install is too easy: just sudo apt install kodi and you're done. There are way too many ways to use Kodi and customize it so I will leave that to you.

RetroArch & Cores

This will require you be logged in locally on the desktop, not over SSH as this requires some finese on the configuration side.

  1. So: sudo apt install retroarch retroarch-assests To install, then we need to run it (As YOUR user): retroarch
  2. Once the setup is done, and to be honest I am really lazy - refer to This tutorial or wing it and configure everything you would like in RetroArch. It's pretty simple and straight forward for even novices to do as RetroArch's UI explains most options for you. The main thing you want to do right here and right now is configure the paths for RetroArch under your home directory (mkdir for the different directory configurations, you will see them in RetroArch's options) and then configure in GUI.
  3. Once the directories are made and configured in the GUI, you need to go to Online Update in RetroArch and download EVERYTHING. It will take some time, but it is worth it in the end. (For cores, you only need cores for emulators that you will be playing.)

NoMachine Install (No setup needed here)

  1. Just download and install it: wget http://download.nomachine.com/download/5.3/Linux/nomachine_5.3.9_6_amd64.deb (This is for x64 based computers, for the RPi please see the NoMachine site.)
  2. Install: sudo dpkg -i nomachine_5.3.9_6_amd64.deb

Make sure to install the NoMachine client on a computer you will be using for remote access. :)

Samba Server install and setup

  1. Install samba: sudo apt install samba
  2. Then modify the config to allow access to your home folder(Add this to the bottom of the conf file): sudo nano /etc/samba/smb.conf
[homes]
   comment = Home Directories
   browseable = no
   read only = no
  1. Restart samba: sudo systemctl restart smbd.service

OpenVPN Installtion for Remote Viewing / Listening (Music / Torrents ONLY)

Honestly, just follow the steps laid out here: https://github.com/Nyr/openvpn-install

UFW / Uncomplicated Firewall.

  1. Install UFW: sudo apt install ufw
  2. Allow only SSH & OpenVPN: sudo ufw allow 22 1194
  3. Enable UFW: sudo ufw enable **MAKE SURE YOU HAVE PORT 22 FOR SSH ALLOWED BEFORE RUNNING THIS.

Using the new media center.

The following services are enabled:

  • qBittorrent Web UI (8081)
  • Subsonic (8080 & 4433(SSL))
  • OpenVPN (1194)
  • Samba(SMB)(139)
  • NoMachine (Lots of ports)

You connect to OpenVPN and then you can access all the services above. I highly recommend setting up Subsonic and qBittorrent to use the same paths so that stuff you download or share is in Subsonic and samba.

Troubleshooting

To be written later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment