Ubuntu 20.04 install guide / headless / running as a service

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
Post Reply
ro55mo
Posts: 1
Joined: Tue Jun 16, 2020 3:00 am

Ubuntu 20.04 install guide / headless / running as a service

Post by ro55mo » Tue Jun 16, 2020 6:06 am

So I have stumbled across this application while researching something for work. Wanted to have a go at installing it. Was surprised to see so many questions about the application running as a service

Got it up and running on a headless Ubuntu 20.04 server and running as a service

I know the optional section might seem a bit redundant but I just wanted to test it worked okay with the media on a separate device

The user running the service is called ums-user which was created during server installation

*** INSTRUCTIONS ***

# ssh into new Ubuntu 20.04 server (headless) server

ssh -p 22 [email protected]

# Install updates pre-reqs

sudo apt-get update

sudo apt-get upgrade

sudo apt-get install openjdk-8-jre openjdk-8-jre-headless

sudo apt-get install mediainfo dcraw vlc mplayer mencoder

# Download onto my PC

https://www.fosshub.com/Universal-Media ... x86_64.tgz

# Copy over to the server

scp -P 22 UMS-9.6.2-x86_64.tgz [email protected]:/home/ums-user/UMS-9.6.2-x86_64.tgz

Unpack

tar xzvf UMS-9.6.2-x86_64.tgz

cd ums-9.6.2

# Test application

./UMS.sh

# Control C to stop application

# Create unit file

sudo nano /etc/systemd/system/ums.service

[Unit]
Description=Run UMS as ums-user
DefaultDependencies=no
After=network.target

[Service]
Type=simple
User=ums-user
Group=ums-user
ExecStart=/home/ums-user/ums-9.6.2/UMS.sh
TimeoutStartSec=0
RemainAfterExit=yes

[Install]
WantedBy=default.target

# Exit and save the file

sudo systemctl daemon-reload

sudo systemctl enable ums.service

sudo systemctl start ums.service

# Check service is running

sudo systemctl status ums.service

[email protected]:~$ sudo systemctl status ums.service
● ums.service - Run UMS as ums-user
Loaded: loaded (/etc/systemd/system/ums.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2020-06-15 14:40:52 UTC; 27s ago

Main PID: 2277 (java)
Tasks: 58 (limit: 9451)
Memory: 153.4M
CGroup: /system.slice/ums.service
└─2277 jre14/bin/java -Xmx1280M -Xss2048k -Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true -Djna.nosys=true -classpath update.jar:ums.jar net.pms.PMS

Jun 15 14:40:53 ums UMS.sh[2277]: INFO 14:40:53.296 [main] Transcoding engine "DCRaw" is available
Jun 15 14:40:53 ums UMS.sh[2277]: INFO 14:40:53.297 [main] Using address /192.168.0.111 found on network interface: name:enp0s3 (enp0s3)
Jun 15 14:40:53 ums UMS.sh[2277]: INFO 14:40:53.297 [main] Created socket: /192.168.0.111:5001
Jun 15 14:40:53 ums UMS.sh[2277]: INFO 14:40:53.320 [main] WEB interface is available at: http://192.168.0.111:9001
Jun 15 14:40:53 ums UMS.sh[2277]: INFO 14:40:53.333 [main] A tiny cache admin interface is available at: http://192.168.0.111:5001/console/home
Jun 15 14:40:54 ums UMS.sh[2277]: INFO 14:40:54.839 [HTTPv2 Request Worker 5] Media renderer was not recognized. Possible identifying HTTP headers:
Jun 15 14:40:54 ums UMS.sh[2277]: User-Agent: DAFUPnP
Jun 15 14:40:54 ums UMS.sh[2277]: Cache-Control: no-cache
Jun 15 14:40:54 ums UMS.sh[2277]: Pragma: no-cache
Jun 15 14:40:55 ums UMS.sh[2277]: INFO 14:40:55.832 [main] Universal Media Server is now available for renderers to find

# Go to application

http://192.168.0.111:9001

# Test service starts after a reboot

sudo reboot

# Check application

http://192.168.0.111:9001

# Success!

# OPTIONAL SECTION

# ssh into Ubuntu 20.04 server (headless) server

ssh -p 22 [email protected]

# Install nfs-common to allow mounting of NFS shares

sudo apt-get install nfs-common

# Edit hosts file so server can locate my FreeNAS media storage

sudo nano /etc/hosts

192.168.0.10 freenas

# Create mount point

sudo mkdir /mnt/FreeNAS

# Edit stab file

sudo nano /etc/fstab

# Add path

freenas:/mnt/Pool /mnt/FreeNAS nfs defaults 0 0

# Reboot server

sudo reboot

# ssh into Ubuntu 20.04 server (headless) server

ssh -p 22 [email protected]

# Check disk space

df -h

Filesystem Size Used Avail Use% Mounted on
udev 3.9G 0 3.9G 0% /dev
tmpfs 797M 1.3M 795M 1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv 125G 8.0G 111G 7% /
tmpfs 3.9G 0 3.9G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/sda2 976M 103M 806M 12% /boot
/dev/loop0 55M 55M 0 100% /snap/core18/1754
/dev/loop1 55M 55M 0 100% /snap/core18/1705
/dev/loop2 69M 69M 0 100% /snap/lxd/14804
/dev/loop3 31M 31M 0 100% /snap/snapd/7777
/dev/loop4 28M 28M 0 100% /snap/snapd/7264
/dev/loop5 70M 70M 0 100% /snap/lxd/15457
freenas:/mnt/Pool 2.1T 972G 1.2T 47% /mnt/FreeNAS
tmpfs 797M 24K 797M 1% /run/user/121
tmpfs 797M 4.0K 797M 1% /run/user/1000

# Success. Storage is mounted

# Setup conf file

nano /home/ums-user/.config/UMS/UMS.conf

# Set "Shared folders"

folders=/mnt/FreeNAS/Movies

# Exit and save the file

Restart UMS

sudo systemctl restart ums.service

# You can now access your media on the server after a couple of minutes. Assume this is UMS scanning the new directories.

# Server level configurations are held at

nano /home/ums-user/ums-9.6.2

SVMartin
Posts: 13
Joined: Tue Jul 21, 2020 9:50 am

Re: Ubuntu 20.04 install guide / headless / running as a service

Post by SVMartin » Tue Jul 21, 2020 9:54 am

Thanks for sharing, works nicely for me!

Note however that it is not required to install openjdk-8-jre and openjdk-8-jre-headless as UMS comes with its own java which has been tested and is up-to-date (v 14).

I'm now trying to add a max heap size setting to the systemd file!

SVMartin
Posts: 13
Joined: Tue Jul 21, 2020 9:50 am

Re: Ubuntu 20.04 install guide / headless / running as a service

Post by SVMartin » Tue Jul 21, 2020 5:31 pm

That was easy, just add the following line to the Service section of the systemd file:

Environment="UMS_MAX_MEMORY=768M"

xmechanic
Posts: 1
Joined: Mon Nov 23, 2020 10:32 am

Re: Ubuntu 20.04 install guide / headless / running as a service

Post by xmechanic » Mon Nov 23, 2020 10:56 am

I understand the majority of this, but I would like to do this on a self-contained machine with a 160 gb. boot drive (dev/sda) and a 3 TB secondary drive (plenty for what I've got!). The 3 TB drive will be split into 2 partitions (/dev/sdb/storage1 and /dev/sdb/storage 2) on the initial install of Ubuntu 20.04 server LTS, so they should show up in /etc/fstab as such. I also plan on running this headless and can use WinSCP to do file transfers, etc. and puTTY for general management. I'm a first-timer for UMS so I want to make sure there actually IS a way to get the system to recognize the 2 partitions on /dev/sdb/ and actually be able to upload local content and be able to access it with the UMS interface. ;)
I've been through 3 or 4 'media management' interfaces on this machine now, including the Turnkey version of Jellyfin, Kodi on Debian, and a couple others, none of which really did what I wanted (namely upload local content and have it show up and be accessible). I have XigmasNAS on a separate machine, but it's more or less dedicated for local machine backups and such, so I wanted my media server to be standalone. Any ideas/solutions appreciated, so I can get this right the first time! :) Thanks!

Post Reply