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).
Emby requires mono to run. Please install mono first, then come back to this guide.
Install Emby by logging in via SSH, then copying and pasting the following:
wget -qO emby.zip $(curl -sL https://api.github.com/repos/MediaBrowser/Emby/releases/latest | grep -P 'browser(.*)Emby.Mono.zip' | cut -d\" -f4) unzip -q ~/emby.zip -d ~/emby rm -rf ~/emby.zip
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:
mono --debug ~/emby/MediaBrowser.Server.Mono.exe
Emby will then go through its launch procedure. Eventually you'll see 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):
port=$(shuf -i 10001-59001 -n 1) sed -i "s|<PublicPort>.*<|<PublicPort>$port<|g" ~/emby/ProgramData-Server/config/system.xml sed -i "s|<HttpServerPortNumber>.*<|<HttpServerPortNumber>$port<|g" ~/emby/ProgramData-Server/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.
- screen -dmS emby /bin/bash -c 'export TMPDIR=~/tmp; ~/bin/mono --debug ~/emby/MediaBrowser.Server.Mono.exe' && echo -e "\nhttp://$(hostname -f):$(sed -rn 's|(.*)<PublicPort>(.*)<\/PublicPort>|\2|p' ~/emby/ProgramData-Server/config/system.xml)"
- check running
- pgrep -fu "$(whoami)" "SCREEN -dmS emby"
- pkill -fu "$(whoami)" 'SCREEN -dmS emby'
- pkill -fu "$(whoami)" 'SCREEN -dmS emby'; sleep 3 && screen -dmS emby /bin/bash -c 'export TMPDIR=~/tmp; ~/bin/mono --debug ~/emby/MediaBrowser.Server.Mono.exe' && echo -e "\nhttp://$(hostname -f):$(sed -rn 's|(.*)<PublicPort>(.*)<\/PublicPort>|\2|p' ~/emby/ProgramData-Server/config/system.xml)"
- kill (force stop)
- pkill -9 -fu "$(whoami)" 'SCREEN -dmS 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.
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.
If you experience issues or crashes using Emby the first thing to try and do is restart the software using the command listed in the section above, "Starting, stopping and restarting"
pkill -9 -fu "$(whoami)" 'SCREEN -dmS emby' rm -rf ~/emby