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

From steamWiki
Jump to: navigation, search
Line 4: Line 4:
  
 
=Install UMS=
 
=Install UMS=
#Install the necessary packages
+
#Install the necessary packages by running the following commands <pre>sudo apt-get install software-properties-common&#10;sudo apt-get update&#10;sudo apt-get install openjdk-8-jre openjdk-8-jre-headless&#10;apt-get install mediainfo dcraw vlc-bin mplayer mencoder</pre>
##run ''sudo apt-get install software-properties-common''
+
#Install UMS 8.0.1 by running the following commands <pre>cd /opt&#10;sudo wget https://downloads.sourceforge.net/project/unimediaserver/Official%20Releases/Linux/UMS-8.0.1.tgz&#10;sudo tar -xvzf UMS-8.0.1.tgz&#10;sudo ln -s /opt/ums-8.0.1 ums&#10;sudo rm UMS-8.0.1.tgz</pre>
##run ''sudo apt-get update''
 
##run ''sudo apt-get install openjdk-8-jre openjdk-8-jre-headless''
 
##run ''apt-get install mediainfo dcraw vlc-bin mplayer mencoder''
 
#Install the latest version of UMS
 
##run ''cd /opt''
 
##run ''sudo wget https://downloads.sourceforge.net/project/unimediaserver/Official%20Releases/Linux/UMS-8.0.1.tgz''
 
##run ''sudo tar -xvzf UMS-8.0.1.tgz''
 
##run ''sudo ln -s /opt/ums-8.0.1 ums''
 
##run ''sudo rm UMS-8.0.1.tgz''
 
 
#Setup UMS to auto start at boot
 
#Setup UMS to auto start at boot
##run ''sudo nano /etc/init.d/ums'' and copy the following into that file.
+
#Create an init.d script by running <pre>sudo nano /etc/init.d/ums</pre> and copying the following into that file <pre>#!/bin/bash&#10;#&#10;### BEGIN INIT INFO&#10;# Provides:          ums&#10;# Required-Start:    $local_fs $remote_fs $network&#10;# Required-Stop:    $local_fs $remote_fs $network&#10;# Default-Start:    2 3 4 5&#10;# Default-Stop:      0 1 6&#10;# Short-Description: Starts UMS program.&#10;# Description:      Java Upnp Media Server dedicated to PS3&#10;### END INIT INFO&#10;&#10;#set -x&#10;&#10;# Author: Papa Issa DIAKHATE <paissad@gmail.com>&#10;#&#10;PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin&#10;DESC="Universal Media Server"&#10;NAME=ums&#10;UMS_PROFILE=/etc/UMS.conf&#10;DAEMON=/opt/ums/UMS.sh&#10;DAEMON_OPTS="console"&#10;SCRIPTNAME=/etc/init.d/ums&#10;UMS_START=1 # Wether to start or not UMS ver at boot time.&#10;DODTIME=30  # Time to wait for the server to die, in seconds.&#10;            # If this value is set too low you might not&#10;            # let the program to die gracefully and 'restart' will not work&#10;&#10;test -x $DAEMON || exit 1&#10;&#10;# Load the VERBOSE setting and other rcS variables&#10;. /lib/init/vars.sh&#10;&#10;# Define LSB log_* functions.&#10;# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.&#10;. /lib/lsb/init-functions&#10;&#10;# Include ums defaults if available&#10;if [ -f "/etc/default/$NAME" ] ; then&#10;        . /etc/default/$NAME&#10;fi&#10;&#10;# May we run the init.d script ?&#10;[ $UMS_START = 1 ] || exit 1&#10;&#10;#--------------------------------------------------------------------------&#10;# Some color codes&#10;txtred=$'\e[0;31m' # Red&#10;txtylw=$'\e[0;33m' # Yellow&#10;txtrst=$'\e[0m'    # Text Reset&#10;#--------------------------------------------------------------------------&#10;warnout(){&#10;    echo >&2 -e ""$txtylw"Warning:$txtrst $1"&#10;}&#10;#--------------------------------------------------------------------------&#10;running(){&#10;    pid=`pgrep -f 'java .*ums.jar.*'`&#10;}&#10;#--------------------------------------------------------------------------&#10;do_start(){&#10;    running && { warnout "$NAME is already running !"; exit 0; }&#10;    echo "Starting $DESC : $NAME"&#10;    UMS_PROFILE="$UMS_PROFILE" start-stop-daemon --start --quiet --background --oknodo \&#10;        --exec $DAEMON -- $DAEMON_OPTS&#10;&#10;}&#10;#--------------------------------------------------------------------------&#10;do_stop(){&#10;    running || { warnout "$NAME is NOT running !"; exit 0; }  &#10;    local countdown="$DODTIME"&#10;    echo -e "Stopping $DESC : $NAME \c "&#10;    kill -9 $pid&#10;    while running; do&#10;        if (($countdown >= 0)); then&#10;            sleep 1; echo -n .;&#10;            ((--countdown))&#10;        else&#10;            break;&#10;        fi&#10;    done&#10;    echo&#10;    # If still running, then try to send SIGINT signal&#10;    running && { \&#10;        echo >&2 "Using kill -s SIGINT instead"; \&#10;        echo >&2 "If you see this message again, then you should increase the value of DODTIME in '$0'."; \&#10;        kill -2 $pid; \&#10;    }&#10;&#10;    if [ -e "/usr/share/ums/debug.log" ]; then&#10;    count=9&#10;    while [ $count -ge 1 ]&#10;    do&#10;    if [ -e "/usr/share/ums/debug.log.$count" ]; then&#10;        plus=$((count+1))&#10;        mv "/usr/share/ums/debug.log.$count" "/usr/share/ums/debug.log.$plus"&#10;    fi&#10;        count=$((count-1))&#10;    done&#10;    if [ -e "/usr/share/ums/debug.log" ]; then&#10;        mv "/usr/share/ums/debug.log" "/usr/share/ums/debug.log.1"&#10;    fi&#10;    fi&#10;&#10;    return 0&#10;}&#10;#--------------------------------------------------------------------------&#10;do_force-stop(){&#10;    running || { warnout "$NAME is NOT running !"; exit 0; }  &#10;    echo "Stopping $DESC : $NAME"&#10;    kill -9 $pid&#10;    if [ -e "/usr/share/ums/debug.log" ]; then&#10;    count=9&#10;    while [ $count -ge 1 ]&#10;    do&#10;    if [ -e "/usr/share/ums/debug.log.$count" ]; then&#10;        plus=$((count+1))&#10;  mv "/usr/share/ums/debug.log.$count" "/usr/share/ums/debug.log.$plus"&#10;    fi&#10;      count=$((count-1))&#10;    done&#10;    if [ -e "/usr/share/ums/debug.log" ]; then&#10;  mv "/usr/share/ums/debug.log" "/usr/share/ums/debug.log.1"&#10;    fi&#10;    fi&#10;}&#10;#--------------------------------------------------------------------------&#10;do_status(){&#10;    echo -n " * $NAME is "&#10;    ( running || { echo "NOT running "; exit 0; } )&#10;    ( running && { echo "running (PID -> $(echo $pid))"; exit 0; } )&#10;}&#10;#--------------------------------------------------------------------------&#10;case "$1" in&#10;&#10;    start|stop|force-stop|status)&#10;        do_${1}&#10;        ;;&#10;    restart|reload)&#10;        do_stop&#10;        do_start&#10;        ;;&#10;   force-restart|force-reload)&#10;        do_force-stop&#10;        do_start&#10;        ;;&#10;    *)&#10;        echo "Usage: $SCRIPTNAME {start|stop|force-stop|restart|force-restart|reload|force-reload|status}"&#10;        exit 1&#10;        ;;&#10;esac</pre>
<nowiki>#!/bin/bash
+
##Make that script executable by running <pre>chmod +x /etc/init.d/ums</pre>
#
+
##Make the system aware of your new script by running <pre>update-rc.d ums defaults</pre>
### 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</nowiki>
 
##run ''chmod +x /etc/init.d/ums''
 
##run ''update-rc.d ums defaults''
 
 
#Configure UMS
 
#Configure UMS
##run ''cp /opt/ums/UMS.conf /etc/''
+
##Copy the default configuration files to ''/etc/'' by running the following commands <pre>sudo cp /opt/ums/UMS.conf /etc/&#10;sudo cp /opt/ums/WEB.conf /etc/ums/</pre>
##run ''cp /opt/ums/WEB.conf /etc/ums/''
+
##Edit ''UMS.conf'' by running <pre>sudo nano /etc/UMS.conf</pre> and setting the following variables (you'll have to setup ''folders'' and ''folders_monitored'' to something specific for your environment) <pre>server_name = MyMediaServer&#10;language = en-US&#10;minimized = true&#10;auto_update = true&#10;hide_advanced_options = false&#10;single_instance = true&#10;chromecast_extension = true&#10;prettify_filenames = true&#10;show_server_settings_folder = true&#10;atz_limit = 3000&#10;show_recently_played_folder = true&#10;folders = /mnt/media/Video/Movies, /mnt/media/Video/TV_Shows, /mnt/media/Video/Web_Shows, /mnt/media/Music, /mnt/media/Comedy&#10;folders_monitored =  /mnt/media/Video/Movies, /mnt/media/Video/TV_Shows, /mnt/media/Video/Web_Shows, /mnt/media/Music, /mnt/media/Comedy&#10;web_port = 80&#10;web_conf = /etc/ums/WEB.conf&#10;name = main</pre>
##run ''sudo nano /etc/UMS.conf'' and set the following variables (you'll have to setup ''folders'' and ''folders_monitored'' to something specific for your environment)
+
=Start UMS=
##*server_name = MyMediaServer
+
#start UMS by running <pre>sudo service ums start</pre>
##*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 by running ''sudo service ums start''
 
 
#visit the UMS webpage by going to ''http://<UMSServerHostname>'' in a web browser
 
#visit the UMS webpage by going to ''http://<UMSServerHostname>'' in a web browser
  

Revision as of 16:43, 11 July 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.

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
  3. Setup UMS to auto start at boot
  4. 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
    1. Make that script executable by running
      chmod +x /etc/init.d/ums
    2. Make the system aware of your new script by running
      update-rc.d ums defaults
  5. 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://<UMSServerHostname> in a web browser

References