Skip to content

Instantly share code, notes, and snippets.

@froseph
Forked from dreamcat4/ums.md
Created August 25, 2014 14:16
Show Gist options
  • Save froseph/33c82316f98bbb4fb833 to your computer and use it in GitHub Desktop.
Save froseph/33c82316f98bbb4fb833 to your computer and use it in GitHub Desktop.

UMS How-To

How to install Universal Media Server. Most of these commands can just be copy-pasted.

Update Finch

Update finch to version 1.25 or newer.

# Finch users should first update to get the latest fixes
[ "$(echo "$(finch --shortver) >= 1.25" | bc)" = 1 ] || sudo finch update -y

# Enter the finch chroot environment, as root
sudo finch chroot

Create a new jail

# Read the page "jail-ip-addresses" before choosing a jail IP address
jail_ip="192.168.1.214"

# Set a matching ip address for the jail's 'lo0' ifconfig device (for localhost)
jail_loopback="lo0|127.0.0.214"

# Give an appropriate server name to your jail
jailname="ums"

# Create a basic jail, with local console access
qjail create -4 "$jail_ip,$jail_loopback" "$jailname"

# Enable unix sockets
qjail config -k "$jailname"

Login to the jail

# Start the jail
qjail start "$jailname"

# Login to our new jail as root
qjail console "$jailname"

Install UMS4

# Set jail's hostname in /etc/hosts file
echo "127.0.0.1 $(hostname)" >> /etc/hosts

# Update local pkgng database, to avoid 'failed checksum' for 'pkg install'
pkg update -f

# Install dependancies from pkgng
ASSUME_ALWAYS_YES=YES pkg install ffmpeg mplayer vlc

# Install mencoder dependancy
cd /usr/ports/multimedia/mencoder && BATCH=YES make install

# Install UMS from pkgng
ASSUME_ALWAYS_YES=YES pkg install universal-media-server

(optional) Install "linux-tsmuxer" transcoder dependancy

This dependancy requires the kernel module linux.ko to be loaded into memory. Unfortunatly NAS4Free users don't have this kernel module provided for them. You guys will have to ask Zoon to add it to the distribution for you.

# Install 'linux-tsmuxer' from pkgng
ASSUME_ALWAYS_YES=YES pkg install linux-tsmuxer

# Exit from the jail
exit

# Check if linux.ko is already being loaded
sysrc kldload_modules | grep linux
kldstat | grep linux.ko

# If linux.ko isn't loaded, add it to the list of modules to load during Finch startup

    sysrc "kldload_modules=$(sysrc -n kldload_modules 2&> /dev/null) linux"

# Load it now
service kldload restart

# Check that 'linux.ko' was successfully loaded
sysrc kldload_modules | grep linux
kldstat | grep linux.ko

# Log back in to our jail
qjail console "$jailname"

Configure, Start UMS4

At this point, you may now wish to consult Mounting Filesystems. And first sort out your media locations so they get mounted inside of the UMS jail.

# Edit the UMS configuration file
nano /var/db/universal-media-server/UMS.conf

# To make UMS aware of your Media folders, add this line you your "UMS.conf" configuration file
folders = /path/to/folder1,/path/to/folder2,etc

# Other UMS settings are documented in the sample config file
cat /var/db/universal-media-server/UMS.conf.sample

# Enable UMS4 rc.d service
sysrc universal_media_server_enable=YES

# Start UMS4
service universal-media-server start

# UMS4 should now appear to connected DLNA clients / media renderers in your Local Network

# Or browse the web-interface on TCP port 9001 of the jail's IP address.
fetch -o - http://${jail_ip}:9001
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment