Emby

This article will show you how to install and configure Emby. Emby is a media player and alternative to Plex.

You'll need to execute some commands via SSH to use this software. There is a separate guide on how to connect to your slot via SSH. Commands are kept as simple as possible and in most cases will simply need to be copied and pasted into the terminal window (then executed by pressing the Enter key).

Table of contents

Installation

Install Emby by logging in via SSH, then copying and pasting the following:

mkdir -p ~/bin && bash
wget -O ~/emby-server-deb.deb https://github.com/MediaBrowser/Emby.Releases/releases/download/4.7.14.0/emby-server-deb_4.7.14.0_amd64.deb
dpkg -x ~/emby-server-deb.deb ~/
sed -i "s|APP_DIR=/|APP_DIR=$HOME/|" ~/opt/emby-server/bin/emby-server
sed -i "s|EMBY_DATA=/var|EMBY_DATA=$HOME/var|" ~/opt/emby-server/bin/emby-server
ln -s ~/opt/emby-server/bin/emby-server ~/bin/emby
rm ~/emby-server-deb.deb

If your binary directory (~/bin) is not in PATH you'll need to give the full path when trying to run the software in that directory. A better alternative is to add the bin directory to PATH.

The rest of the guide assumes you have done this and will simply use emby to run the emby binary, instead of ~/bin/emby.

Configuring before starting Emby

You need to start and then close Emby so that it'll create the necessary configs. Do so with the following command:

emby

Emby will then go through its launch procedure. Eventually you'll either see an error (and Emby will close automatically, creating the config) or a line which says Info App: All entry points have started. At this point, press ctrl + c to close Emby and create the config.

We also need to change the port number, since the default can naturally only be used once per server. To randomise it and set this port in the configs, copy and paste these commands (the start command in the section below will tell you how to access Emby):

httpPort=$(shuf -i 10001-59001 -n 1)
httpsPort=$(shuf -i 10001-59001 -n 1)
sed -i "s|<PublicPort>.*<|<PublicPort>$httpPort<|g" ~/var/lib/emby/config/system.xml
sed -i "s|<HttpServerPortNumber>.*<|<HttpServerPortNumber>$httpPort<|g" ~/var/lib/emby/config/system.xml
sed -i "s|<PublicHttpsPort>.*<|<PublicHttpsPort>$httpsPort<|g" ~/var/lib/emby/config/system.xml
sed -i "s|<HttpsPortNumber>.*<|<HttpsPortNumber>$httpsPort<|g" ~/var/lib/emby/config/system.xml

Starting, stopping and restarting

This section covers the Emby process - starting it, stopping it and restarting it. It also covers checking if the process is running, in case that becomes necessary.

start
screen -dmS emby emby && echo -e "\nhttp://$(hostname -f):$(sed -rn 's|(.*)<PublicPort>(.*)<\/PublicPort>|\2|p' ~/var/lib/emby/config/system.xml)"
check running
pgrep -fu "$(whoami)" "emby"
stop
pkill -fu "$(whoami)" 'emby'
restart
pkill -fu "$(whoami)" 'emby'; sleep 3 && screen -dmS emby emby && echo -e "\nhttp://$(hostname -f):$(sed -rn 's|(.*)<PublicPort>(.*)<\/PublicPort>|\2|p' ~/var/lib/emby/config/system.xml)"
kill (force stop)
pkill -9 -fu "$(whoami)" 'emby'

The check command works as follows: if the process is running a list of relevant process ID numbers will be listed; if nothing is listed the process is not running.

Automatically restarting Emby if it is not running

Cron jobs can be used to check if Emby is running and start it up if it is not. There is a separate page on configuring cron jobs.

Using Emby

Access Emby via the URL produced by the start command. You should be taken to a wizard - rather than repeating what they've written, please refer to Emby's documentation on the wizard.

Once you have added a user, you should access the Emby dashboard and click Users on the left-hand side. Click your user, then scroll down and make sure Hide this user from login screens is enabled.