[Tutorial] Installing UMS 4.4.0 on Ubuntu Server 14.04.1

For help and support with Linux-specific issues
Forum rules
Please make sure you follow the Problem Reporting Guidelines before posting if you want a reply
Kayot
Posts: 8
Joined: Tue Jan 07, 2014 8:36 am

[Tutorial] Installing UMS 4.4.0 on Ubuntu Server 14.04.1

Post by Kayot » Wed Jan 14, 2015 8:36 am

This is an update and correction to my original post located here -> viewtopic.php?f=10&t=1519

So, I've just built a truly badass system. I'm talking the whole nine yards, ECC Ram, Xeon Processor... you name it. I'm planning on using FreeNAS once I get the 10 4TB drives. But that's going to take a few months. In the mean time, I'm using Ubuntu 14.04.1. So my Google search pulled up my old instuctions and well... they suck. So here are the new instructions.

I suggest doing this over SSH since it gives the ability to copy paste into the terminal. I'm using putty in Windows 8.1 to interact with my Headless Ubuntu Server.

1. This is going to be done in root, and rather then put sudo in front of every SINGLE line and forget a few times at critical points, we'll just jump into it.

Code: Select all

sudo su
2. The nice people at Web Upd8 have taken the Java headache off our hands and put together nice package for our convenience. That installs Java 7 and sets environmental variables. I suggest doing it one line at a time.

Code: Select all

add-apt-repository ppa:webupd8team/java
apt-get update
apt-get install oracle-java7-installer
apt-get install oracle-java7-set-default
3. Now some pre-reqs. Do we need them all? I have no idea. If you don't have the space for this, why are you setting a streaming service up? Really, get your priorities straight.

Code: Select all

sudo apt-get install mediainfo dcraw vlc-nox mplayer mencoder openssh
4. Lets get UMS 4.4.0. This is going to be downloaded, extracted, and misplaced. I'm putting it into /usr since I have no idea about Linux install policies, and I really don't care. It's like /media vs /mnt arguments.

Code: Select all

cd ~
wget http://sourceforge.net/projects/unimediaserver/files/Official%20Releases/Linux/UMS-4.4.0-Java7.tgz
tar -xvzf UMS-4.4.0-Java7.tgz
mv ums-4.4.0 /usr/ums
rm UMS-4.4.0-Java7.tgz
5. Now lets put together a nice init.d script that will make starting and stopping the media server a breeze.

Code: Select all

sudo nano /etc/init.d/ums
Put this into the ssh window. Don't even try typing all of this.

Code: Select all

#!/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 <[email protected]>
#
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="Universal Media Server"
NAME=ums
UMS_PROFILE=/etc/ums
DAEMON=/usr/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
Push Ctrl-o to output the file, then Ctrl-x to exit.

6. We need to make it executable so:

Code: Select all

chmod +x /etc/init.d/ums
7. If you want it to start with Linux, then add it to the rc.

Code: Select all

update-rc.d ums defaults
Now let us turn it on:

Code: Select all

service ums start
To stop it:

Code: Select all

service ums stop
To edit it's config, the config file is located at

Code: Select all

/usr/ums/UMS.conf
That wraps it up. Enjoy your media streaming server.

Sources:
http://www.webupd8.org/2012/01/install- ... u-via.html <- Java Instuctions
viewtopic.php?f=10&t=1519 <- My older post, plus note on chmod
viewtopic.php?f=10&t=2211#p12013 <- Some newer info
Last edited by Kayot on Mon May 11, 2015 4:30 am, edited 2 times in total.

twistedLucidity
Posts: 11
Joined: Mon Jan 12, 2015 12:30 am

Re: [Tutorial] Installing UMS 4.4.0 on Ubuntu Server 14.04.1

Post by twistedLucidity » Thu Jan 15, 2015 9:36 am

Great post!

For SSH to be possible, ones needs to remember to select OpenSSH when installing the server, or if one forgot:

Code: Select all

sudo apt-get install openssh
I have my test system running on OpenJDK (which is in Canonical's default repositories, "open-7-jre-headless", no need for WebUpd8), is there any benefit to choosing Oracle's?

This post explains how to configure UMS under systemd (as that is replacing init.d).

"mplayer" actually installs "mplayer2". Not a big deal on Ubuntu, but might confuse people installing on a different *nix.

Thanks for the "vlc-nox" tip, save me install X.org on a server!

Agent_Rocket
Posts: 15
Joined: Tue Sep 09, 2014 8:53 am

Re: [Tutorial] Installing UMS 4.4.0 on Ubuntu Server 14.04.1

Post by Agent_Rocket » Fri Jan 16, 2015 1:27 am

Kayot wrote: To edit it's config, the config file is located at

Code: Select all

/usr/ums/UMS.conf
isn't the config location set in this line in the init.d script

Code: Select all

UMS_PROFILE=/etc/ums
?
or will it use the one in the install location if there's nothing found at the path given?

whatever the path, people will at least want to change the folders so that there's actually content shown on the server. maybe you should mention that as well.

apart from that, great guide.

Kayot
Posts: 8
Joined: Tue Jan 07, 2014 8:36 am

Re: [Tutorial] Installing UMS 4.4.0 on Ubuntu Server 14.04.1

Post by Kayot » Fri Jan 16, 2015 1:55 pm

@twistedLucidity - I honestly don't know if one is better than the other. I just use the real thing since I can and I don't care about GNU and all that licence crap. To me, it's all barriers to trade and knowledge. Thanks for the heads up on the ssh requirement. I added it to the apt-get lists.

@Agent_Rocket - I'm not completely sure. I'm still setting my system up. I was having some samba problems early on, then a permissions error. I custom compiled my kernel for aufs with hnotify to avoid whiteout problems, so it's all still coming together. I'll know more when I get it under control. I don't use the streaming system and the people who do haven't done so as of yet.

In all honesty, I'm looking into using NFS mounting software on my windows machines to dodge all this samba run around. They should make an option that just shares. My network is secure, as are most that run home networks.

twistedLucidity
Posts: 11
Joined: Mon Jan 12, 2015 12:30 am

Re: [Tutorial] Installing UMS 4.4.0 on Ubuntu Server 14.04.1

Post by twistedLucidity » Fri Jan 16, 2015 10:54 pm

Kayot wrote:I honestly don't know if one is better than the other. I just use the real thing since I can and I don't care about GNU and all that licence crap. To me, it's all barriers to trade and knowledge.
Actually, it's the other way around. The GPL ensures there are no barriers to trade and knowledge; Oracle...not so much. But that's a different discussion.

My main point was that it you stuck to OpenJDK you don't need to futz around with another repo; removes a few hoops from the process.
I run various Java servers on OpenJDK - not had one jot of trouble.

Be interested to hear what you have to say about NFS mounts in Windows.

vijvis
Posts: 1
Joined: Mon May 11, 2015 1:03 am

Re: [Tutorial] Installing UMS 4.4.0 on Ubuntu Server 14.04.1

Post by vijvis » Mon May 11, 2015 1:06 am

To have it start on boot, I had to make the additional changes to the /etc/init.d/ums script:

if [[ -f “/etc/default/$NAME” ]] ; then
becomes
if [ -f “/etc/default/$NAME” ] ; then

and
[[ $UMS_START = 1 ]] || exit 1
becomes
[ $UMS_START = 1 ] || exit 1

Cheers.

Kayot
Posts: 8
Joined: Tue Jan 07, 2014 8:36 am

Re: [Tutorial] Installing UMS 4.4.0 on Ubuntu Server 14.04.1

Post by Kayot » Mon May 11, 2015 4:30 am

Updated with correction listed in previous post.

99altezza
Posts: 10
Joined: Sun Jul 26, 2015 10:12 pm

Re: [Tutorial] Installing UMS 4.4.0 on Ubuntu Server 14.04.1

Post by 99altezza » Sun Jul 26, 2015 10:17 pm

Hi, I'm don't know anything about Linux or UMS, but I followed this post to install UMS in Ubuntu.

I think it has installed properly, but when I type 'service ums start' - it ask me for a password after I type my password and enter, nothing really happens. Am I suppose to see the UMS application some where or is it all working at the backend?
Also, if it's at the backend, how do I configure it so it can connect with my ps3?

I will also be having an external hard drive on the laptop so I can stream movies from it on the PS3, if someone knows the answer on what the next step is, please help.


Thanks

Kayot
Posts: 8
Joined: Tue Jan 07, 2014 8:36 am

Re: [Tutorial] Installing UMS 4.4.0 on Ubuntu Server 14.04.1

Post by Kayot » Mon Jul 27, 2015 2:28 am

The last part of the op tells you where your config file is.
To edit it's config, the config file is located at

Code: Select all

/usr/ums/UMS.conf
Also, it does run in the back ground. If you have a GUI (Desktop) then you can run the java app directly and take advantage of it's graphical front end. This guide is for someone running a headless server and who wants to add this to it.

To be honest, I stopped using UMS. My PS3 is hacked so I started using Showtime (Now Movian) instead. If your ps3 isn't hacked, I suggest buying a Pi2 and putting OpenELEC on it. UMS can be troublesome and it's easier to just have the system that would stream it, decode it instead.

Edit: If your laptop has an HDMI port out, I suggest you simply plug that into your TV and play movies that way. It will save you a lot of grief.

99altezza
Posts: 10
Joined: Sun Jul 26, 2015 10:12 pm

Re: [Tutorial] Installing UMS 4.4.0 on Ubuntu Server 14.04.1

Post by 99altezza » Mon Jul 27, 2015 10:42 pm

HI,

Thanks for your reply, I have typed '/usr/ums/UMS.conf' on Terminal but it says 'bash: /usr/ums/UMS.conf: Permission denied'

Also, I have installed a front end gui recommended by someone with the following code; 'sudo apt-get install xorg gnome-core gnome-system-tools gnome-app-install'
But after the install, I am not able to open the gui - do you know how it works?

Post Reply