[Testing] Simple Emby Server installer

I’ve made a simple installer for Emby Server, which has been tested on a Raspberry Pi 3 with OSMC 16.1. It is based on a broken tutorial on how to install the Emby Server, which sprung from the discussion that be found here.

The goal of this project is to cleanly and easily install the Emby Server on OSMC, and integrate it with the Kodi installation that the OSMC install contains. You are hereby told that this installer takes SEVERAL hours to complete, so please be patient. (If there was a way to speed it up, I’d try it!)

If you’re not familiar with Emby, check out http://www.emby.media

What is Emby?

In essence Emby, formerly MediaBrowser is a server software intended to provide an open source media server that can be used as a fancy DLNA server as well as through their own apps. It can also be tightly integrated with Kodi.

When integrated with kodi/Osmc Emby provides a great way to manage your media and metadata from any web browser as well as sync play positions between devices - Running Kodi or anything else!

What this installer does:

1. Prompts the user to decide whether to use stable or latest beta branch. 2. Installs several prerequisites, such as aptitude, unzip, and git. 3. Installs several dependencies, such as the ImageMagick, webp, mediainfo and sqlite3 packages. 4. Builds and installs FFmpeg. 5. Installs the Mono libraries from Xamarin 6. Installs the selected branch of Emby Server from GitHub (no intervention required) 7. Gets and installs the latest Emby for Kodi addons (only if [b]/home/osmc/.kodi[/b] is present) 8. Creates a service so that the Emby Server starts automatically.

Optional actions this script can do:

1. Creates/Removes a Cron job, to be executed every night at midnight, in order to keep Emby up-to-date. 2. Can update the script. 3. Seperately install the Emby for Kodi addons. 4. Change the Emby Server installation branch (stable/beta) 5. Rebuild FFmpeg from the Git repository.

How to start the installer:

> wget https://raw.githubusercontent.com/douglasorend/osmc_install_emby/master/install-emby.sh > chmod +x ./install-emby.sh > ./install-emby.sh

Hope you enjoy it.

GitHub Repository

https://github.com/douglasorend/osmc_install_emby
3 Likes

Great work!
Is it a proof of concept or is emby actually usable now?

I used the script to install Emby on my Raspberry Pi, and the Emby Server is usable. The script should be able to be used on the earlier Wheezy OSMC versions of Debian, although I haven’t tested it…

Let me know if you encounter any problems with the script, or have any ideas how it can be improved… Thanks!

Thanks man.
I’d like to add, that it’s wise to install with screen.

Screen, for those who do not know, makes you able to resume and ‘reconnect to screens’… essentially a ‘screen’ is just a terminal wrapper, and lets you reconnect later.

Usage:
sudo apt-get install screen screen # ...start a long running job which must keep connected (what if it asks something and I lose the session! E.g.: apt-get install mess up?) # Ctrl A, D (release CTRL-A, then press D). You now are detached and can disconnect the terminal. # late (on a new session maybe): screen -r # ah... nice, it's done.

i needed to add a couple of things before i got this working since mono is such a piece of crap

export TZ=“/usr/share/zoneinfo/Europe/Stockholm”

https://bugzilla.xamarin.com/show_bug.cgi?id=30360

Unhandled Exception:
System.InvalidTimeZoneException: TZ file too big for the buffer
  at System.TimeZoneInfo.BuildFromStream (System.String id, System.IO.Stream stream) <0x754b8720 + 0x000e4> in <filename unknown>:0 
  at System.TimeZoneInfo.FindSystemTimeZoneByFileName (System.String id, System.String filepath) <0x754b45a0 + 0x00043> in <filename unknown>:0 
  at System.TimeZoneInfo.CreateLocal () <0x754b25e8 + 0x002bb> in <filename unknown>:0 
  at System.TimeZoneInfo.get_Local () <0x754b21dc + 0x0002f> in <filename unknown>:0 
  at System.TimeZoneInfo.GetDateTimeNowUtcOffsetFromUtc (DateTime time, System.Boolean& isAmbiguousLocalDst) <0x754b41f4 + 0x0002b> in <filename unknown>:0 
  at System.DateTime.get_Now () <0x7530c170 + 0x0008f> in <filename unknown>:0 
  at MediaBrowser.Common.Implementations.Logging.NlogManager.ReloadLogger (LogSeverity level) <0x74559510 + 0x000bb> in <filename unknown>:0 
  at MediaBrowser.Server.Mono.MainClass.Main (System.String[] args) <0x752a1388 + 0x000db> in <filename unknown>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.InvalidTimeZoneException: TZ file too big for the buffer
  at System.TimeZoneInfo.BuildFromStream (System.String id, System.IO.Stream stream) <0x754b8720 + 0x000e4> in <filename unknown>:0 
  at System.TimeZoneInfo.FindSystemTimeZoneByFileName (System.String id, System.String filepath) <0x754b45a0 + 0x00043> in <filename unknown>:0 
  at System.TimeZoneInfo.CreateLocal () <0x754b25e8 + 0x002bb> in <filename unknown>:0 
  at System.TimeZoneInfo.get_Local () <0x754b21dc + 0x0002f> in <filename unknown>:0 
  at System.TimeZoneInfo.GetDateTimeNowUtcOffsetFromUtc (DateTime time, System.Boolean& isAmbiguousLocalDst) <0x754b41f4 + 0x0002b> in <filename unknown>:0 
  at System.DateTime.get_Now () <0x7530c170 + 0x0008f> in <filename unknown>:0 
  at MediaBrowser.Common.Implementations.Logging.NlogManager.ReloadLogger (LogSeverity level) <0x74559510 + 0x000bb> in <filename unknown>:0 
  at MediaBrowser.Server.Mono.MainClass.Main (System.String[] args) <0x752a1388 + 0x000db> in <filename unknown>:0

#Updated script to v0.3 - July 30th, 2016
o Limited choices of options on startup, depending on whether Emby is installed.
o Changed section titles in script to SSH window titles.
o Changed dialog boxes to use ASCII characters instead of graphics.
o Reorganized script file to move certain functions to the top.
o Added code to copy script to Emby Server folder when updating the script.
o Added cron task to remove “mediabrowser-server.pid” after reboot.
o Added code to fix time zone issue found by Toast (in OSMC forum)

1 Like

#Updated script to v0.4 - July 30th, 2016
o Fixed updating script to pull from correct URL.

Note to everybody: Script Updating does not work in v0.1 thru v.0.3. Please redownload from the website instead of updating through the script. Failure to follow these instructions means you will have a blank file in place of your install-emby.sh script! Thank you!

mind adding a standalone installation without kodi addons also ? think im gonna migrate it my installation to another arm device and so far yours is the only installer a that actually works :slight_smile:

keep up the awesome job
// Toast

ps. your link to the script in first post is 404: Not Found

Updated script to v0.5 - August 1st, 2016

o Changed home path variable to detection of user’s home folder.
o Changed start menu to only “Install Emby” and “Update Script” if Emby not found.
o Changed Emby installer to install addons only if Kodi is detected.
o Changed “Add Cron” menu option to toggle status of Cron job.
o Added option to install just Kodi add-ons. Returns error if Kodi not detected.
o Added option to select stable or beta branch of Emby Server to use.
o Added option to change branch of Emby Server in use.


@Toast: I’ve taken care of the incorrect URL in the first post. Thank you for pointing it out!

Concerning running this script on a non-Debian OS, it may work and it may not. I have no information on how to detect other installs than Debian installs (which includes OSMC and Ubuntu), so I am not able to update the script to install Mono properly on those systems. Plus changing Emby’s configuration files may not work properly, either.

1 Like

the script was intended for a debian machine running on a arm soc just not OSMC :slight_smile:

No, the script was originally intended to work solely on OSMC, and was solely tested on OSMC Jessie. Revisions to make it more compatible with prior versions of OSMC (Wheezy) were made in v0.3. Other configurations (such as Ubuntu and Raspbian) haven’t been tested, but MAY work.

This is great, should I start with a fresh OSMC? Currently running the June 2016 update on my Raspi2. I will be migrating from a SQL server that is running on my Pi1 which I want to use for another project.

Ideally I would like to use OSMC and Emby as a dedicated Kodi headless unit that updates my library and keeps everything in sync that stays on 24/7, that will be it’s sole purpose. I don’t need or want the trancoding features, this is just to keep my library in sync and updated so other Kodi boxes don’t have to.

Updated script to v0.6 - August 1st, 2016

o Fixed error installing prerequisite packages.
o Changed code to attempt automatic detection of appropriate Emby configuration.

@johnsnow: For rather obvious reasons, a fresh install of OSMC would be best. But I’m also interested in knowing how it installs on a dirtier version of OSMC, as well, specifically whether or not the prerequisites and dependencies have any problems installing… Solving these issues like this would definitely help make this script even better.

You wanna use OSMC plus Emby as a dedicated Kodi headless unit? Perfect fit! I have OSMC, Emby and a few other problems co-existing on my Raspberry Pi 3… Still making minor changes here and there, but it works great. I’m not sure how the RPi3 is transcoding video, but that can easily be disabled in the Admin settings.

I’ll hold off for now as I’m still looking for the best solution for my migration and my OSMC install is rather clean, it has a few addon’s and a theme I can easily remove. I kept my installation clean and simple as possible without adding to many things and never installed anything without first testing on my windows PC. I have always used official OSMC releases and only updated via the online updater and not from cmdline.

It’s great that transcoding can be disabled as that is something I do not want, just need an easy to use media manager that syncs my library across my LAN.

Will keep an eye on this thread to see how your script improves.

Is there a way to backup the Emby database to an external storage device or actually just store it on a USB key? I’ve had SD card corruption in the past and just want to avoid possible data loss. This is one of the main reason’s for me to move away from a Raspi HTPC.

I might be wrong here, but I don’t think that Kodi add-ons are the kind of packages that would interfere with this script…

Your Emby data is stored in opt/mediabrowser/ProgramData-Server/data. Provided you shut down Emby before you move the data, it shouldn’t be too hard to link that folder with a USB key… I might even be able to write something up for that, too…

#Updated script to v0.7 - August 5th, 2016
o Fixed function to toggle status of auto-updating cron job.
o Changed code to attempt to install Mono for Debian < 8 and Ubuntu.
o Added option to install Emby for Kodi addons.
o Added option to rebuild FFmpeg from GitHub repository.
o Added code to shutdown and restart Kodi when install addons.
o Removed references to aptitude from the script.
o Removed code to install Emby for Kodi addons during Emby install.

@johnsnow: I’ve been working on the moving stuff to USB stick code, but it’s not complete yet.

So far the installer has really been a god send :slight_smile: minor issues here and there when running the script

like these

./install-emby.sh: line 290: /root/install-emby.sh: No such file or directory

it looks for the installer scripts in the wrong folder etc but over all it works.

Uploaded v0.8 - October 3rd, 2016
o Changed Emby version detection to avoid storing version in seperate file.
o Changed Emby service file to use sudo to start/stop service and remove PID file.
o Changed Emby upgrade code to use temporary folder to store old files.
o Changed Emby install code to use temporary folder to store new files.
o Changed Emby service to swap old and new Emby Server folders at service start.

1 Like

Hello,

I’ve just tried it and the installer seems to be working, but the emby did not started. I found this: [HowTo] Install Emby-Server (BROKEN) where some setting was mentioned for config files. I did it and I can reach the url now. When in a browser I try to play a movie it fails. In the log I see an error which refers to a file not found problem for ffmpeg. How ever it is installed. Do you know what kind of setting is missing for me?

Thanks

@taszilo19, did you fix it?

Same thing happens here. I was able to install, run the url and add my library.
But when I hit play, nothing happens. I tried both on browser and on the iOS app.

Logs attached.

Thanks

Log.pdf (15.4 KB)
Log_2.pdf (339.2 KB)