FAQ  •  Register  •  Login

Installing Serviio 1.10, Kubuntu/Ubuntu 18.04, FFMPEG 3.4.x

<<

SparkyHenderson

Serviio newbie

Posts: 9

Joined: Tue Sep 08, 2015 9:51 pm

Post Tue Dec 04, 2018 6:38 pm

Installing Serviio 1.10, Kubuntu/Ubuntu 18.04, FFMPEG 3.4.x

Serviio Linux Install Notes
General Notes:
This installation is based on Kubuntu 18.04 LTS 64 bit http://kubuntu.org/ . Kubuntu is an official release of the Ubuntu project.

There are three broad groups of actions to get Serviio up and running on Linux. First we check for Java, then we check for a supported version of ffmpeg, and finally we install Serviio itself. If you actually need to build ffmpeg then look for one of my older posts (SparkyHenderson) for instructions.

I avoid using third party repositories whenever possible. All the software installed in these instructions either comes from the official Ubuntu/Kubuntu repositories or from the developers' web sites. With these instructions it's easy enough to build ffmpeg just the way you need it without opening yourself up to an anonymous source's choices that aren't appropriate for you.

I'm starting with a VMware virtual machine setup with 2048 MB of RAM, 2 virtual CPU cores, and a single NIC. You may be able to use less RAM, but I think a minimum of 2 CPU cores is important for smooth performance. If you choose to use my optional RAM drive trick (towards the end) to speed up ffmpeg transcoding, you will be very glad you had 2 or more CPUs. I have tested the virtual machine under VMware's vSphere 6.5 and Fusion 10. (I am a VMware nerd.) I do my installations logged in as root. You may want to do all this as a sudoer by prepending "sudo" to all the commands below. Be my guest, but I would lose my mind; my mind is already wandering just thinking about it.

Quick refresher - If you need to unlock the root account in Ubuntu, first set the root password, then unlock the account like this (please lock it back up when you're done):
  Code:
sudo passwd root
sudo passwd -u root


Keywords:
Serviio, Linux, server, media server, headless, DLNA UPnP, Kubuntu, Ubuntu, Java, Oracle, JRE, ffmpeg, build, NAS, lossless, flac, wav, mpc, lossy, mp3, ogg, vorbis, Ubuntu 18.04, Kubuntu 18.04, systemd

Just a thought! - You virtual machine builders may want to take a snapshot here. (We'll do this a few times throughout this set of instructions.)

I recommend you install and use aptitude. The options are just a little different from apt and apt-get, but you can accomplish all the same tasks. (I like aptitude for its safe-upgrade option.)


******************************************************************************************
Don't do this - Install Oracle Java
******************************************************************************************
Notes:
The Open JDK is perfectly robust now. In my case it's "10.0.2" 2018-07-17. As a big bonus we now get regular updates without doing any manual magic. Just relax and go with what's installed with Ubuntu 18.

Do not install the Oracle Java 11 JDK. It won't work because parts of Java EE have been completely dropped from the Java 11 JDK and there are no more JRE or Server JRE downloads available. Oracle isn't winning any friends here and Serviio will need to have some code revision to get past this. The fix that works for Java 9 and Java 10 simply fail now. Stick with the Open JDK.

******************************************************************************************
ffmpeg
******************************************************************************************
Notes:
Finally. FINALLY! Finally Ubuntu is up to speed with a very current ffmpeg instead of some ancient after though version. The Ubuntu 18.04 LTS repositories now contain version 3.4.4, which is the version the Serviio 1.10 is happy with. As of this writing the latest version 3 branch from ffmpeg.org is 3.4.5. For the first time I'm not building my own version of ffmpeg and I'm sticking with the Ubuntu repository version.

If you are on Ubuntu 18.04 LTS or above then just do this:
  Code:
aptitude -y install ffmpeg


If you are on an older version of Ubuntu then find my older instructions on building your own ffmpeg.

******************************************************************************************
Serviio server installation
******************************************************************************************
Notes:
This is the easiest part of the whole process. If you needed to install a different version of Java or build your own FFMPEG then you may be wishing you had gone with the Windows or Mac version, but you're here now so let's do this!

I have chosen to install the Serviio under the /opt directory structure. Why? Because Serviio stores its data under its installation directory and I really dislike when programs store data in any of the ./bin or ./sbin directories (/, /usr, or /local). I see it as FHS directory polution. Just my opinion. Some days I'm just a little cranky. But seriously, install it wherever you want. Just substitute your path as appropriate.

I create a symlink in /opt called /opt/serviio. This lets me completely change the actual Serviio software to a different version or do a clean installation without having to change my desktop shortcuts or other scripts. Great for doing updates while preserving your database and settings! Just change the symlink in one place to the new/desired Serviio directory and everything else just works.

Highly recommended - Perform the optional steps below to create a dedicated user account with restricted rights to run Serviio programs. If you don't then you will need to set the appropriate file and directory permissions as needed on your own.

convenience copy:
  Code:
aptitude install dcraw &&\
cd ~ &&\
wget http://download.serviio.org/releases/serviio-1.10-linux.tar.gz &&\
tar xf ~/serviio-1.10-linux.tar.gz -C /opt/ &&\
ln -s /opt/serviio-1.10/ /opt/serviio


Steps details:
I decided that RAW image support would be nice. If you want this too then install dcraw. Cut and paste:
  Code:
aptitude install dcraw


Do I have to say to download Serviio? Nah, but I will anyway. Here's how I did it. Make sure you get the most recent version.:
  Code:
cd ~
wget http://download.serviio.org/releases/serviio-1.10-linux.tar.gz


Untar your serviio-whatever-the-tar-is-called to /opt. You will do something like this:
note: -C makes tar change directory first then unpack
  Code:
tar xf ~/serviio-1.10-linux.tar.gz -C /opt/


Make a symlink in /opt from your specific version directory to a generic directory link called /opt/serviio/ like this:
  Code:
ln -s /opt/serviio-1.10/ /opt/serviio


The user and group will be essentially unset (set to some numerical value that may or not match existing UID). Do consider setting user and group information to an appropriately restricted user. See the optional steps just below. If you don't want to create a restricted user account then just set the user and group to whatever you like. You will find the server and console start scripts in /opt/serviio/bin .
Enjoy!

Just a thought! - You virtual machine builders may want to take a snapshot here.

******************************************************************************************
Create a restricted user account to run Serviio and set permissions
******************************************************************************************
Notes:
We will create a limited user account, set the ownership and permissions, and finally create a startup script and configure it to run at boot.

The way I'm doing it here, only the user serviio and root will be able to get to the log and config files. If you have a designated user that needs to get to these files just add them to the serviio group.

Important -> Did you make the symlink I suggested? All the commands below rely on that symlink you created.

chown does not follow symlinks by default. Add the -L flag.

chmod always follows symlinks.

Do not test run Serviio from the root account. Don't do it! Even though we're creating a user with no default shell, you can still use that restricted account to launch Serviio from the command line. I'll show you how. You do not need to test by using the root account. (OK, it is your system, so go ahead if you must. It's not my place to tell you what to do, but I wouldn't do it. I admit that I actually did test as root the very first time I started this write up, but then I rolled back to my previous snapshot.)

Convenience copies of the commands for adding the user and setting the permisions are right here for your convenience. See the individual commands below for explainations.
  Code:
adduser --system --group --disabled-password serviio

- The adduser command only needs to be run the very first time you install, not for subsequent upgrades.
- Add a user named serviio. (Whatever you want to call it is fine.)
- Setup the new user as a system user that, by default, will have no login shell.
- Create a group with the same name and use as primary.
- The password is disabled for tighter security.

  Code:
chown -R -L serviio:serviio /opt/serviio && \
chmod -R o= /opt/serviio && \
find -L /opt/serviio -type d -print0 | xargs -0 chmod g+s && \
chmod -R ug+rw /opt/serviio

- This compound command updates ownership and permissions, and should be run every time a new version is installed.

Just a thought! - You virtual machine builders may want to take a snapshot here before you run Serviio for the first time.

******************************************************************************************
Run Serviio from the command line using our restricted user account.
******************************************************************************************
Notes:
Do not run Serviio as root. Don't do it! Even though our limited serviio user has no default shell and the password is disabled, there is an easy way to run the program. You do need to be logged in as root to run this command, but the command will run using only the serviio user permissions.

Steps:
Run the Serviio server like this:
  Code:
su -s /bin/bash -c /opt/serviio/bin/serviio.sh serviio

- use the super user command
- tell it to use the bash shell
- tell it to run the command /opt/serviio/bin/serviio.sh
- tell it to use the user serviio

You should see "Created user preferences directory" the first time you run Serviio using the command above. This message will not be shown on subsequent runs.

At this point you could start the console with the script in /opt/serviio/bin but it's easier just to use the URL directly.
To test this from a different machine just change "localhost" to the appropriate IP address or URL. Don't forget to add "console".
  Code:
http://localhost:23423/console/


Once you're satisfied Serviio is happy then just Ctrl+C to break out of the server. It will close cleanly.

(A little off topic.)
An easy way to test audio transcoding fast is to set your device's profile to DirecTV and restart Serviio. This profile transcodes nearly everything, so pick a non-mp3 audio file and see if it gets delivered as an mp3 to your renderer.


******************************************************************************************
Optional performance tweak - setup a RAM drive for transcode operations
(this will be 10x or more faster than any SSD)
******************************************************************************************
Notes:
I do not know what the behavior with videos that are larger than the RAM disk is. I didn't test that aspect. Do some research and please tell me how it worked out for you.

This assumes you will use the system /tmp for transcoding. If you will transcode to a different directory you will have to modify the line you add to fstab.

Beware that if your total RAM is too low then all kinds of ugly swap file action will take place and your system will slow to a crawl. I tested with 3GB of RAM, I think 2GB would work too.

The noexec option is not appropriate if you will use this machine for compiling and building other apps. Build tests will frequently use /tmp to save executable files and then try to run them. I use the noexec parameter because my "NAS Gizmo" is not my development machine. I also use noexec on the entire /home directory tree.


Steps:
Edit your /etc/fstab and add the following line. Cut and paste:
  Code:
none   /tmp   tmpfs   nodev,noexec,size=25%   0   0

- There is no source device.
- Assumes you are mounting at /tmp (make this match whatever you set as the transcode directory).
- The tmpfs file system type is dynamic and only takes as much RAM as it needs without preallocating.
- The options nodev and noexec will help with security a little bit.
- I used size=25%, which uses up to 25 percent of the total RAM.
- 0 0 just standard dump etc. options.

When you look at your mounted devices you should see a line that is similar to this:
none on /tmp type tmpfs (rw,nodev,noexec,relatime,size=507480k)


******************************************************************************************
systemd launch at boot up script - for Ubuntu 15.04 and above
******************************************************************************************
Lifted directly from the wiki at: http://wiki.serviio.org/doku.php?id=how ... buntu15-04
They really made this easy.

create a file /lib/systemd/system/serviio.service
put the following inside of it:
  Code:
[Unit]
Description=Serviio Media Server
After=syslog.target local-fs.target network.target

[Service]
Type=simple
User=serviio
Group=serviio
ExecStart=/opt/serviio/bin/serviio.sh
ExecStop=/opt/serviio/bin/serviio.sh -stop
KillMode=none
Restart=on-abort

[Install]
WantedBy=multi-user.target


Do the following commands:
  Code:
chmod u=rw,g=r,o=r /lib/systemd/system/serviio.service &&\
systemctl daemon-reload &&\
systemctl enable serviio.service &&\
systemctl start serviio.service


The service runs using the name java and not Serviio. I don't know how to make the name that shows up with a ps command any different. Let me know if you figure it out.

Just a thought! - Everything running the way you like? Now might be a good time to export your VM to a template file (OVA, OVF, etc.). You can delete those pesky snapshots too.
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Thu Dec 06, 2018 12:30 pm

Re: Installing Serviio 1.10, Kubuntu/Ubuntu 18.04, FFMPEG 3.

this would be a great wiki article btw :-)
<<

SparkyHenderson

Serviio newbie

Posts: 9

Joined: Tue Sep 08, 2015 9:51 pm

Post Fri Dec 07, 2018 6:52 pm

Re: Installing Serviio 1.10, Kubuntu/Ubuntu 18.04, FFMPEG 3.

zip wrote:this would be a great wiki article btw :-)


OK! I've procrastinated for a several years now, but I'm finally going to make a Wiki article.

Thanks for making such a great product Petr.

Cheers,
Sparky
<<

atc98092

User avatar

DLNA master

Posts: 5202

Joined: Fri Aug 17, 2012 10:22 pm

Location: Washington (the state)

Post Sun Dec 09, 2018 3:19 am

Re: Installing Serviio 1.10, Kubuntu/Ubuntu 18.04, FFMPEG 3.

I've been tinkering around with Linux, and just installed Ubuntu 18.04. I cannot get Serviio to start, as it returns the following error:

  Code:
java.lang.module.FindException: Module java.xml.ws not found


running java -version returns openjdk 11.0.1. Any ideas?

EDIT: nevermind. Discovered that there were multiple versions of openjdk installed, and version 8 was not set to default. As soon as I changed the default it started right up.
Dan

LG NANO85 4K TV, Samsung JU7100 4K TV, Sony BDP-S3500, Sharp 4K Roku TV, Insignia Roku TV, Roku Ultra, Premiere and Stick, Nvidia Shield, Yamaha RX-V583 AVR.
Primary server: Intel i5-6400, 16 gig ram, Windows 10 Pro, 22 TB hard drive space | Test server Windows 10 Pro, AMD Phenom II X4 965, 8 gig ram

HOWTO: Enable debug logging HOWTO: Identify media file contents
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Sun Dec 09, 2018 9:49 am

Re: Installing Serviio 1.10, Kubuntu/Ubuntu 18.04, FFMPEG 3.

1.10.1 will ship with Java 11 support
<<

SparkyHenderson

Serviio newbie

Posts: 9

Joined: Tue Sep 08, 2015 9:51 pm

Post Sun Dec 09, 2018 7:45 pm

Re: Installing Serviio 1.10, Kubuntu/Ubuntu 18.04, FFMPEG 3.

It's too bad that Oracle made such big changes to Java 11. I'm sure A LOT of programmers out there are going to be fixing this through the coming year.
<<

freaknik

User avatar

DLNA master

Posts: 345

Joined: Thu Mar 27, 2014 2:05 pm

Location: Endor

Post Wed Dec 12, 2018 3:15 pm

Re: Installing Serviio 1.10, Kubuntu/Ubuntu 18.04, FFMPEG 3.

great article.

Maybe disclaimer or asterisk warning people about damage from root changes, but I guess most *nix'ers already are aware of that.

Good job!
<<

bolzass

Serviio lover

Posts: 67

Joined: Thu Jan 02, 2014 6:32 pm

Post Fri Jan 04, 2019 5:19 am

Re: Installing Serviio 1.10, Kubuntu/Ubuntu 18.04, FFMPEG 3.

Great howto!

About your thought:
SparkyHenderson wrote:The service runs using the name java and not Serviio. I don't know how to make the name that shows up with a ps command any different. Let me know if you figure it out.


You could try:
  Code:
exec -a Serviio "$JAVA"


C'ya!
<<

thatfellow

Serviio newbie

Posts: 10

Joined: Sat Mar 23, 2013 11:51 am

Post Mon Mar 18, 2019 4:54 am

Re: Installing Serviio 1.10, Kubuntu/Ubuntu 18.04, FFMPEG 3.

Great tutorial, thanks for your time..

I have a query..

I am installing on VM, sharing all my media from my synology.
When I used the guide above and mounted the synology, the user "serviio" created above could not see my /mnt folder
I got the above to work 100% but I had to start serviio from the root account, see code below for my setup..

  Code:
apt update
apt -y install aptitude
apt -y install openjdk-8-jre-headless
aptitude -y install ffmpeg

aptitude install dcraw &&\
cd ~ &&\
wget http://download.serviio.org/releases/serviio-1.10.1-linux.tar.gz &&\
tar xf ~/serviio-1.10.1-linux.tar.gz -C /opt/ &&\
ln -s /opt/serviio-1.10.1/ /opt/serviio

apt -y install nfs-common
mount -t nfs 192.168.1.250:/volume1/_Media /mnt

su -s /bin/bash -c /opt/serviio/bin/serviio.sh root



My question, can you give me the modified bash syntax to make the "serviio" account created above an actual user account so I can grant access to my nfs share..
or maybe there is an easier way, but as it is, when i start serviio from "serviio" user account, I cannot see my nas share, but when I skip the "serviio" user account creation & ownership edit above & run from root, everything works 100% but I dont want to use root account for obvious reasons. I know a few people will say I should be using the NAS version but i want to have the latest build and I think the NAS version is falling too far behind the current build, & also, I wanted to beef up the hardware spec..

I hope this is all clear enough to get the help I need..


Thanks again for great tut..
<<

freaknik

User avatar

DLNA master

Posts: 345

Joined: Thu Mar 27, 2014 2:05 pm

Location: Endor

Post Sun Mar 24, 2019 7:44 am

Re: Installing Serviio 1.10, Kubuntu/Ubuntu 18.04, FFMPEG 3.

just change it manually after is probably easier if you are just installing once on one machine.

Go to the directory above the folder you want to change, and say if you wanted user nebula for folder Blackhole

sudo chown -R nebula:nebula /path/to/Blackhole

and your user has access.

Return to User experiences

Who is online

Users browsing this forum: No registered users and 6 guests

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.