Skip to content

Instantly share code, notes, and snippets.

@dreamcat4
Last active December 8, 2018 12:49
Show Gist options
  • Save dreamcat4/1ca69c7f1d215eafcfa7 to your computer and use it in GitHub Desktop.
Save dreamcat4/1ca69c7f1d215eafcfa7 to your computer and use it in GitHub Desktop.
How to Install Universal Media Server on FreeBSD, FreeNAS / NAS4Free / pfSense, with Finch v1.25- http://dreamcat4.github.io/finch/

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
@mniedworok
Copy link

Starting universal_media_server.
cannot create %%UMS_LOG_DIR%%/UMS.log: No such file or directory
eval: cannot create %%UMS_PID_DIR%%/UMS.pid: No such file or directory

@Tikkoneus
Copy link

Apologies if I've done something stupid. I got successfully down through to "Install UMS 4", specifically the mencoder dependency:
"# Install mencoder dependancy
cd /usr/ports/multimedia/mencoder:

But /usr/ports/multimedia doesn't exist! It exists in the finch chroot, but not inside the jail. Should that have been set up by installing some package? Either way it seems as though something isn't right. Any ideas? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment