Difference between revisions of "How to setup Universal Media Server 8.0.1 under Ubuntu 18.04"

From steamWiki
Jump to: navigation, search
Line 20: Line 20:
 
##start UMS by running <pre>sudo service ums start</pre>
 
##start UMS by running <pre>sudo service ums start</pre>
 
##visit the UMS webpage by going to ''http://MyMediaServer'' in a web browser
 
##visit the UMS webpage by going to ''http://MyMediaServer'' in a web browser
 +
 +
=How to Update to the latest version=
 +
#Visit https://github.com/UniversalMediaServer/UniversalMediaServer/releases to find the latest version
 +
#Navigate to the installation folder by running <pre>cd /opt</pre>
 +
#Download the latest tarball by running something like <pre>sudo wget https://github.com/UniversalMediaServer/UniversalMediaServer/releases/download/9.0.0/UMS-9.0.0.tgz</pre> MAKE SURE YOU CHANGE THE ABOVE LINE TO THE CORRECT VERSION
 +
#Unpack the tarball by running <pre>sudo tar -xvzf UMS-*.tgz</pre>
 +
#Stop the ums service by running <pre>sudo systemctl stop ums</pre>
 +
#Update the "ums" symlink by running <pre>sudo ln -sfn /opt/ums-9.0.0/ ums</pre> MAKE SURE YOU CHANGE THE ABOVE LINE TO THE CORRECT VERSION
 +
#Remove the downloaded tarball by running <pre>sudo rm UMS-*.tgz</pre>
 +
#Start the ums service by running <pre>sudo systemctl start ums</pre>
  
 
=References=
 
=References=

Revision as of 16:13, 29 September 2019

Universal Media Server (or UMS for short) is a pretty cool program that will both create a browsable website of your media as well as stream it to compliant devices that support UPnP or DLNA.

This howto is adapted from this article describing how to install an older version of UMS on an older version of Ubuntu.

*This article assumes the hostname of your server is MyMediaServer

Install UMS

  1. Install the necessary packages by running the following commands
    sudo apt-get install software-properties-common
    sudo apt-get update
    sudo apt-get install openjdk-8-jre openjdk-8-jre-headless
    apt-get install mediainfo dcraw vlc-bin mplayer mencoder
  2. Install UMS 8.0.1 by running the following commands
    cd /opt
    sudo wget https://downloads.sourceforge.net/project/unimediaserver/Official%20Releases/Linux/UMS-8.0.1.tgz
    sudo tar -xvzf UMS-8.0.1.tgz
    sudo ln -s /opt/ums-8.0.1 ums
    sudo rm UMS-8.0.1.tgz

Make UMS Start on Boot

  1. Create an init.d script by running
    sudo nano /etc/init.d/ums
    and copying the following into that file
    #!/bin/bash
    #
    ### BEGIN INIT INFO
    # Provides:          ums
    # Required-Start:    $local_fs $remote_fs $network
    # Required-Stop:     $local_fs $remote_fs $network
    # Default-Start:     2 3 4 5
    # Default-Stop:      0 1 6
    # Short-Description: Starts UMS program.
    # Description:       Java Upnp Media Server dedicated to PS3
    ### END INIT INFO
    
    #set -x
    
    # Author: Papa Issa DIAKHATE <paissad@gmail.com>
    #
    PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
    DESC="Universal Media Server"
    NAME=ums
    UMS_PROFILE=/etc/UMS.conf
    DAEMON=/opt/ums/UMS.sh
    DAEMON_OPTS="console"
    SCRIPTNAME=/etc/init.d/ums
    UMS_START=1 # Wether to start or not UMS ver at boot time.
    DODTIME=30  # Time to wait for the server to die, in seconds.
                # If this value is set too low you might not
                # let the program to die gracefully and 'restart' will not work
    
    test -x $DAEMON || exit 1
    
    # Load the VERBOSE setting and other rcS variables
    . /lib/init/vars.sh
    
    # Define LSB log_* functions.
    # Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
    . /lib/lsb/init-functions
    
    # Include ums defaults if available
    if [ -f "/etc/default/$NAME" ] ; then
            . /etc/default/$NAME
    fi
    
    # May we run the init.d script ?
    [ $UMS_START = 1 ] || exit 1
    
    #--------------------------------------------------------------------------
    # Some color codes
    txtred=$'\e[0;31m' # Red
    txtylw=$'\e[0;33m' # Yellow
    txtrst=$'\e[0m'    # Text Reset
    #--------------------------------------------------------------------------
    warnout(){
        echo >&2 -e ""$txtylw"Warning:$txtrst $1"
    }
    #--------------------------------------------------------------------------
    running(){
        pid=`pgrep -f 'java .*ums.jar.*'`
    }
    #--------------------------------------------------------------------------
    do_start(){
        running && { warnout "$NAME is already running !"; exit 0; }
        echo "Starting $DESC : $NAME"
        UMS_PROFILE="$UMS_PROFILE" start-stop-daemon --start --quiet --background --oknodo \
            --exec $DAEMON -- $DAEMON_OPTS
    
    }
    #--------------------------------------------------------------------------
    do_stop(){
        running || { warnout "$NAME is NOT running !"; exit 0; }   
        local countdown="$DODTIME"
        echo -e "Stopping $DESC : $NAME \c "
        kill -9 $pid
        while running; do
            if (($countdown >= 0)); then
                sleep 1; echo -n .;
                ((--countdown))
            else
                break;
            fi
        done
        echo
        # If still running, then try to send SIGINT signal
        running && { \
            echo >&2 "Using kill -s SIGINT instead"; \
            echo >&2 "If you see this message again, then you should increase the value of DODTIME in '$0'."; \
            kill -2 $pid; \
        }
    
        if [ -e "/usr/share/ums/debug.log" ]; then
        count=9
        while [ $count -ge 1 ]
        do
        if [ -e "/usr/share/ums/debug.log.$count" ]; then
            plus=$((count+1))
            mv "/usr/share/ums/debug.log.$count" "/usr/share/ums/debug.log.$plus"
        fi
            count=$((count-1))
        done
        if [ -e "/usr/share/ums/debug.log" ]; then
            mv "/usr/share/ums/debug.log" "/usr/share/ums/debug.log.1"
        fi
        fi
    
        return 0
    }
    #--------------------------------------------------------------------------
    do_force-stop(){
        running || { warnout "$NAME is NOT running !"; exit 0; }   
        echo "Stopping $DESC : $NAME"
        kill -9 $pid
        if [ -e "/usr/share/ums/debug.log" ]; then
        count=9
        while [ $count -ge 1 ]
        do
        if [ -e "/usr/share/ums/debug.log.$count" ]; then
            plus=$((count+1))
       mv "/usr/share/ums/debug.log.$count" "/usr/share/ums/debug.log.$plus"
        fi
           count=$((count-1))
        done
        if [ -e "/usr/share/ums/debug.log" ]; then
       mv "/usr/share/ums/debug.log" "/usr/share/ums/debug.log.1"
        fi
        fi
    }
    #--------------------------------------------------------------------------
    do_status(){
        echo -n " * $NAME is "
        ( running || { echo "NOT running "; exit 0; } )
        ( running && { echo "running (PID -> $(echo $pid))"; exit 0; } )
    }
    #--------------------------------------------------------------------------
    case "$1" in
    
        start|stop|force-stop|status)
            do_${1}
            ;;
        restart|reload)
            do_stop
            do_start
            ;;
        force-restart|force-reload)
            do_force-stop
            do_start
            ;;
        *)
            echo "Usage: $SCRIPTNAME {start|stop|force-stop|restart|force-restart|reload|force-reload|status}"
            exit 1
            ;;
    esac
  2. Make that script executable by running
    chmod +x /etc/init.d/ums
  3. Make the system aware of your new script by running
    update-rc.d ums defaults

Configure UMS

    1. Copy the default configuration files to /etc/ by running the following commands
      sudo cp /opt/ums/UMS.conf /etc/
      sudo cp /opt/ums/WEB.conf /etc/ums/
    2. Edit UMS.conf by running
      sudo nano /etc/UMS.conf
      and setting the following variables (you'll have to setup folders and folders_monitored to something specific for your environment)
      server_name = MyMediaServer
      language = en-US
      minimized = true
      auto_update = true
      hide_advanced_options = false
      single_instance = true
      chromecast_extension = true
      prettify_filenames = true
      show_server_settings_folder = true
      atz_limit = 3000
      show_recently_played_folder = true
      folders = /mnt/media/Video/Movies, /mnt/media/Video/TV_Shows, /mnt/media/Video/Web_Shows, /mnt/media/Music, /mnt/media/Comedy
      folders_monitored =  /mnt/media/Video/Movies, /mnt/media/Video/TV_Shows, /mnt/media/Video/Web_Shows, /mnt/media/Music, /mnt/media/Comedy
      web_port = 80
      web_conf = /etc/ums/WEB.conf
      name = main

Start UMS

    1. start UMS by running
      sudo service ums start
    2. visit the UMS webpage by going to http://MyMediaServer in a web browser

How to Update to the latest version

  1. Visit https://github.com/UniversalMediaServer/UniversalMediaServer/releases to find the latest version
  2. Navigate to the installation folder by running
    cd /opt
  3. Download the latest tarball by running something like
    sudo wget https://github.com/UniversalMediaServer/UniversalMediaServer/releases/download/9.0.0/UMS-9.0.0.tgz
    MAKE SURE YOU CHANGE THE ABOVE LINE TO THE CORRECT VERSION
  4. Unpack the tarball by running
    sudo tar -xvzf UMS-*.tgz
  5. Stop the ums service by running
    sudo systemctl stop ums
  6. Update the "ums" symlink by running
    sudo ln -sfn /opt/ums-9.0.0/ ums
    MAKE SURE YOU CHANGE THE ABOVE LINE TO THE CORRECT VERSION
  7. Remove the downloaded tarball by running
    sudo rm UMS-*.tgz
  8. Start the ums service by running
    sudo systemctl start ums

References