Sunday, January 8, 2017

Slimserver on CentOS Linux running under VirtualBox on Solaris


New Slimserver install

I got some time over Christmas to update my home server, so have migrated my Slimserver aka Squeezeboxserver aka LogitechMediaServer systems from Ubuntu onto brand new clean CentOS installs.

What follows is the recipe I followed to achieve this.

Configuration

  • Host system: Solaris 11 x86
  • Virtualisation software: Virtual Box
  • Squeezebox platform: CentOS

Install and configuration steps

First up, download the latest CentOS ISO, configure a VirtualBox instance, and run through a minimal install.Then run through the following;

Configure IP address

cd /etc/sysconfig/network-scripts
vi ifcfg-enp0s3
BOOTPROTO=static
IPADDR=192.168.0.90
NETMASK=255.255.255.0
GATEWAY=192.168.0.2
NM_CONTROLLED=no
ONBOOT=yes


Fix sudoers so we can sudo without a password

%wheel  ALL=(ALL)       NOPASSWD: ALL

Update /etc/hosts and /etc/resolv.conf

nameserver 192.168.0.1
reboot now


Update OS

yum update

Install guest additions

yum groupinstall "Development tools"
reboot now

Insert guest additions from menu option in machine console
mount /dev/cdrom /mnt
sh /mnt/VBoxLinuxAdditions.run
umount /mnt
reboot now



Ensure vboxsf module is loaded at boot

Without this the kernel module to enable VirtualBox isn't available when the OS comes to boot mount the shared filesystem.

vi /etc/rc.modules
modprobe vboxsf
chmod 755 /etc/rc.modules
reboot now

Present shared folder with mp3


NB: I had a load of hassle with the shared folder. I kept getting protocol errors which I believe were due to mount point being in use or some other such annoyance but eventually it worked with the following settings and a reboot.
Present SharedFolder and ensure it is not set to Auto-Mount, then update /etc/fstab so it is mounted on reboot

vi /etc/fstab
mp3 /mp3 vboxsf uid=richard,ro 0 0
mkdir /mp3

Install slimserver

Now we have a working OS, let's install the slimserver software.


yum install wget
wget http://downloads.slimdevices.com/LogitechMediaServer_v7.7.5/logitechmediaserver-7.7.5-1.noarch.rpm
rpm --install logitechmediaserver-7.7.5-1.noarch.rpm

The startup script needs to be edited so all perl libraries can be found.
vi /etc/init.d/squeezeboxserver
..after INIT INFO comments at top, set our @INC
PERL5LIB=$PERL5LIB:/usr/lib/perl5/vendor_perl:/usr/share/squeezeboxserver/lib
export PERL5LIB

Add firewall rule

cd /etc/firewalld/services
vi slimserver.xml

<?xml version="1.0" encoding="utf-8"?>
<service>
<short>slimserver</short>
<description>Slimserver
9000 TCP is used for the Web interface and streaming to Squeezebox players.
9000 UDP is not used for anything.
3483 TCP is the control channel for Squeezeboxen (display, IR, etc.)
3483 UDP is used for SB->SlimServer discovery, and all control and
streaming to the old SLIMP3 players
</description>
<port protocol="tcp" port="9000"/>
<port protocol="tcp" port="3483"/>
<port protocol="udp" port="3483"/>
</service>

firewall-cmd --permanent --add-service=slimserver
firewall-cmd --reload
firewall-cmd --list-services


Install required perl modules

yum install perl-HTTP-Cookies.noarch perl-CGI.noarch perl-Digest-MD5.x86_64
/etc/init.d/squeezeboxserver start
/etc/init.d/squeezeboxserver stop

Reload systemd config and reboot

Confirm startup settings are refreshed, and slimserver will start.
Then reboot to confirm all good.

systemctl daemon-reload
systemctl enable squeezeboxserver
systemctl start squeezeboxserver
reboot now

Fix configuration

Once booted we should be up and running.
So point browser at IP:9000, enter login details, then ensure we are using the correct library source for our mp3 collection.

If migrating, previous preferences can be copied over at this point.
Note that just copying over the server.prefs is problematic. Presumably due to UUID clash if the old slimserver instance is running.
Prefs are held under /var/lib/squeezeboxserver/prefs
If required, we can reinitialise server.prefs by making it zero length.

First of all, stop slimserver
systemctl stop squeezeboxserver


Now copy prefs lines from old file up to _ts_allowedHosts - insert at beginning of existing prefs file. This will keep all of our presets.

Also copy over favorites.opml,and then restart;
systemctl start squeezeboxserver

BBC iPlayer config

This was not straightforward due to finding the correct repo and also a missing library which doesn't seem to be documented anywhere. The missing library is the secret sauce here!

Add this repo in the plugins page;
http://downloads.sourceforge.net/project/bpaplugins/betarelease-repo.xml
Tick "Update plugins automatically" and "Show all 3rd party plugins".

Restart slimserver;
systemctl restart squeezeboxserver
Repeat until no more messages re. plugins updated, restart required.
NB: It is preferable to use systemd to restart so it can keep track of PIDs.

Tick "BBCiPlayer - DASH" and "BBCiPlayerExtra" and apply.

Now for secret sauce
systemctl stop squeezeboxserver
yum install glibc.i686
systemctl start squeezeboxserver


Now we should have a CentOS OS with Slimserver and iPlayer plugin working.

The only other thing to mention here is that after my initial install I decided to rename the server. Easy enough within CentOS, but to rename the VM and it's disk files, use the VirtualBox GUI as this keeps all of the config files consistent.