Install Universal Media Server on Ubuntu for a complete DLNA server that works on a variety of devices. It is on github and releases are hosted on Sourceforge too. For a full DLNA server comparison to Plex and Serviio features see this link. DLNA devices include support for streaming video to Microsoft XBOX, Sony Playstations, Smart TVs and other devices. Universal Media Server will transcode too in case your TV or DLNA client doesn't support the right codec. You will find a range of plugins for Universal Media Server, here is the full list. This tutorial was tested on Ubuntu 14.x and includes a Universal Media Server init.d script so it will autostart on boot.
Pi Unit | ||||||||
---|---|---|---|---|---|---|---|---|
Raspberry Pi 3 | Quad Core | |||||||
Raspberry Pi 2 | Quad Core | |||||||
Raspberry Pi | Single Core | |||||||
Banana Pi | Dual Core | |||||||
Banana Pi Pro | Dual Core |
Install Universal Media Server on Ubuntu
Install Java on Ubuntu first, accept the license
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | sudo tee -a /etc/apt/sources.list.d/webupd8team-java.list
echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | sudo tee -a /etc/apt/sources.list.d/webupd8team-java.list
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
sudo apt-get update
sudo apt-get install oracle-java8-installer -y
Autodownload using this rather hacky bash script, if it fails then you can replace $UMSURL with the latest download link from Sourceforge
UMSURL=$(wget -q http://sourceforge.net/projects/unimediaserver/files/Official%20Releases/Linux/ -O - | grep UMS | awk -F "[\"]" '{print $2}' | grep /download | awk 'NR==1 {print $1}')
wget $UMSURL -O UMS.tgz
sudo mkdir -p /opt/UMS
tar --strip-components=1 -xzf UMS.tgz -C /opt/UMS
Change ownership of the Universal Media Server folder to your main user
sudo chown -R htpcguides:htpcguides /opt/UMS
Check if Universal Media Server runs
cd /opt/UMS
./UMS.sh
If you don't see any errors then use Ctrl+C to kill the process in the SSH session
Install VLC for transcoding video files to your Smart TV or other DLNA devices which may lack the necessary codecs
sudo apt-get install vlc-nox -y
Autostart Universal Media Server init.d Script
Create the Universal Media Server init.d script
sudo nano /etc/init.d/ums
Paste the Universal Media Server init.d script and adjust the DAEMON_USER
to your username
#!/bin/sh
### BEGIN INIT INFO
# Provides: Universal Media Server
# 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: Universal Media Server
# Description: Universal Media Server
### END INIT INFO
# Documentation available at
# http://refspecs.linuxfoundation.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptfunc.html
# Debian provides some extra functions though
. /lib/lsb/init-functions
DAEMON_NAME="UniversalMediaServer"
DAEMON_USER=htpcguides
DAEMON_PATH="UMS.sh"
DAEMON_OPTS=""
DAEMON_PWD="/opt/UMS"
DAEMON_DESC=$(get_lsb_header_val $0 "Short-Description")
DAEMON_PID="/var/run/${DAEMON_NAME}.pid"
DAEMON_NICE=0
DAEMON_LOG='/var/log/universalmediaserver'
[ -r "/etc/default/${DAEMON_NAME}" ] && . "/etc/default/${DAEMON_NAME}"
do_start() {
local result
pidofproc -p "${DAEMON_PID}" "${DAEMON_PATH}" > /dev/null
if [ $? -eq 0 ]; then
log_warning_msg "${DAEMON_NAME} is already started"
result=0
else
log_daemon_msg "Starting ${DAEMON_DESC}" "${DAEMON_NAME}"
touch "${DAEMON_LOG}"
chown $DAEMON_USER "${DAEMON_LOG}"
chmod u+rw "${DAEMON_LOG}"
if [ -z "${DAEMON_USER}" ]; then
start-stop-daemon --start --quiet --oknodo --background \
--nicelevel $DAEMON_NICE \
--chdir "${DAEMON_PWD}" \
--pidfile "${DAEMON_PID}" --make-pidfile \
--exec "${DAEMON_PATH}" -- $DAEMON_OPTS
result=$?
else
start-stop-daemon --start --quiet --oknodo --background \
--nicelevel $DAEMON_NICE \
--chdir "${DAEMON_PWD}" \
--pidfile "${DAEMON_PID}" --make-pidfile \
--chuid "${DAEMON_USER}" \
--exec "${DAEMON_PATH}" -- $DAEMON_OPTS
result=$?
fi
log_end_msg $result
fi
return $result
}
do_stop() {
local result
pidofproc -p "${DAEMON_PID}" "${DAEMON_PATH}" > /dev/null
if [ $? -ne 0 ]; then
log_warning_msg "${DAEMON_NAME} is not started"
result=0
else
log_daemon_msg "Stopping ${DAEMON_DESC}" "${DAEMON_NAME}"
killproc -p "${DAEMON_PID}" "${DAEMON_PATH}"
result=$?
log_end_msg $result
rm "${DAEMON_PID}"
fi
return $result
}
do_restart() {
local result
do_stop
result=$?
if [ $result = 0 ]; then
do_start
result=$?
fi
return $result
}
do_status() {
local result
status_of_proc -p "${DAEMON_PID}" "${DAEMON_PATH}" "${DAEMON_NAME}"
result=$?
return $result
}
do_usage() {
echo $"Usage: $0 {start | stop | restart | status}"
exit 1
}
case "$1" in
start) do_start; exit $? ;;
stop) do_stop; exit $? ;;
restart) do_restart; exit $? ;;
status) do_status; exit $? ;;
*) do_usage; exit 1 ;;
esac
Make the Universal Media Server init.d script executable
sudo chmod +x /etc/init.d/ums
Tell Ubuntu to start Universal Media Server on boots
sudo update-rc.d ums defaults
Start Universal Media Server service
sudo service ums start
You can access the headless Universal Media Server on the default port 9001 http://IP.address:9001/console
You can initiate a scan for new media from this location http://IP.address:5001/console/index.html
Configure Universal Media Server
Open the UMS configuration file
nano /opt/UMS/UMS.conf
Change the language
language = en-US
Change the GUI setting so Universal Media Server doesn't open a gui since we're running it headless
minimized = true
Choose the port of Universal Media Server
port = 9001
You can also change the sorting method which can help make TV shows and/or music show up correctly
# GUI selector generates a numeric indicator according to the following.
# 0: Alphabetical A-Z
# 1: By date (newest first)
# 2: By reverse date (oldest first)
# 3: ASCIIbetical (i.e. using ASCII code values)
# 4: Alphanumeric (AKA natural sort e.g. "Season 2" before "Season 10")
# 5: Random
# 6: No Sorting
# Default: 4
sort_method = 4
You can also remove the releasegroup and quality by enabling prettify
prettify_filenames = true
If you want to use imdb info set this parameter, note that it becomes true automatically if you enable prettify
use_imdb_info = true
By default Universal Media Server will scan your system for media, if you'd rather specify folders then set your media folders as a comma separated values list
folders = /home/htpcguides/TV, /mnt/usbstorage/Movies
Set the number of CPU cores for Universal Media Server to use
# CPU threads to use when enabled for engine
# ------------------------------------------
# Choose the number of processor cores that should be used for transcoding.
# Default: "", which will use automatic-detection.
number_of_cpu_cores = 2
Enable gpu transcoding if your system supports it and you are using vlc to transcode
gpu_acceleration = true
When you are done restart Universal Media Server
sudo service ums restart
Now you can go to the Universal Media Server web interface on its default port 9001 and watch video in your browser