View Full Version : Manual installation on FC6 using yum w/ existing MySql

2007-03-25, 21:35
The work on the Fedora Yum Repo appears to be stalled. I tried the repository on a previous test installation of FC6 on the audio server I've been building, and it seemed to work ok, but I found it frustrating not being able to upgrade to the latest version of the server and player firmware.

Inspired by that work and by the effort at http://weblog.drymartini.org/2006/12/slimserver_battle.html, I decided try attempt a more manual effort.

After putting so much effort into configuring the server and SqueezeBoxes, I wanted the following results:

Separate audio rips from slimserver and OS
Separate slimserver from OS

Separation gives better control over physical backup and recovery in case of hardware failure, or OS configuration corruption. Because the OS is now separate, it is straightforward to purge the OS partition, reinstall a different or upgraded Linux distribution, if required. Separating the audio supports similar disaster recovery and upgrade plans. The following events are inevitable:

Hard disk failure (need to replace hard disk)
Server hardware failure (need to replace audio server)

Also a possibility SlimServer or SqueezeBox obsolesence.

After rebuilding my audio server, I installed FC6, and used "yum update" to ensure that all components are updated. To import the RedHat GPG keys manually (although the presence of gpgkey in the yum.repos.d/* files suggests that this is not strictly required):

% rpm --import /etc/pki/rpm-gpg/*

Note: A SlimServer and Fedora (FC3) specific guide is at https://www.ripcaster.co.uk/node/18. A detailed FC6 (not SlimServer specific) installation guide is at http://www.mjmwired.net/resources/mjm-fedora-fc6.html.

Additional Perl components are required to complete the installation. These are mostly obtained from the Fedora and Dries repositories. To access the Dries repository, create /etc/yum.repos.d/dries.repo containing the repository metadata specified below.

The only other additional repository is reb00t (I used the mirror at rpm.pbone.net). The section of interest in this site only serves up RPMs with no repository metadata, so a localinstall is required.

reb00t ftp://ftp.pbone.net/mirror/reb00t.com/fedora/6/perl/

RPMs from reb00t are not signed and cannot be installed
directly from the site. Instead each needs to be
downloaded and installed using "yum localinstall".

dries http://dries.ulyssis.org/rpm/

name=Dries Fedora RPMs

atrpms http://atrpms.net

name=Fedora Core $releasever - $basearch - ATrpms

RedHat core and extras repositories are enabled by default, so components can be installed using:

# yum install <packagename>

AtRPM, Dries and RedHat development repositories are not normally enabled and must be selected for installation:

# yum --enablerepo=development <packagename>


# yum --enablerepo=dries <packagename>


# yum --enablerepo=atrpms <packagename>

The reb00t repository entries must be downloaded to the local filesystem before installing:

# wget 'http:...'
# yum localinstall <packagefile>

Use the search function in rpm.pbone.net to locate the URL of the reb00t RPMs.

Of all the components required, only one (perl-DBIx-Migration) could not be found in external repositories, and I had to get it from the slimserver repository. Rather than install the slimserver repository in yum.repos.d for that single file, I chose to simply download the one RPM required from http://repos.slimdevices.com/yum/slimserver-testing/fc6/i386/.

# wget 'http://repos.slimdevices.com/...'
# yum localinstall <packagefile>

Packages were installed in the order listed.

# Dependencies to avoid build-perl-modules.pl:

core perl-XML-Parser.i386 2.34-
dries perl-YAML-Syck.i386 0.72-1.fc6.rf

# Runtime dependencies:

extras perl-File-Slurp 9999.12-2.fc6.noarch
development perl-XML-Simple 2.16-2.fc7
extras perl-File-Which 0.05-2.fc6
extras perl-Path-Class 0.16-1.fc6
dries perl-Tie-Cache 0.17-1.2.fc6.rf
dries perl-Class-Virtual 0.06-1.fc6.rf
extras perl-Text-Unidecode 0.04-4.fc6
extras perl-File-BOM 0.14-1.fc6
dries perl-Tie-LLHash 1.003-1.2.fc6.rf
core perl-IO-String 1.08-1.1.1
dries perl-URI-Find 0.16-1.fc6.rf
reb00t perl-Class-Data-Accessor 0.03-1.n0i.2
dries perl-Data-Dump 1.08-1.fc6.rf
extras perl-POE 0.9917-1.fc6
extras perl-Cache-Cache 1.05-1.fc6
extras perl-File-Find-Rule 0.30-2.fc6
extras perl-Template-Toolkit.i386 2.18-1.fc6
dries perl-Tie-RegexpHash 0.15-1.fc6.rf
core perl-TimeDate 1:1.16-3.2.1
dries perl-Proc-Background 1.08-1.2.fc6.rf
dries perl-Net-UPnP 1.2.1-1.fc6.rf
dries perl-JSON 1.07-1.fc6.rf
reb00t perl-DBIx-Class 0.06_999_05-1.n0i.5.0.06999_05.fc6
extras perl-Class-Inspector 1.16-2.fc6
slimserver perl-DBIx-Migration 0.05-1.fc6
atrpms perl-Locale-Hebrew 1.04-2.fc6.at
extras perl-GD 2.35-2.fc6

2007-03-25, 21:40
Once the additional packages are installed, I used the following steps to install SlimServer.

In the following description, # is used to indicate a root shell prompt, and $ to indicate a non-root shell prompt.

Couple SlimServer into FC6 installation:

# groupadd slimserver
# useradd -d /mnt/slimserver/home -g slimserver slimserver

# ln -s /mnt/slimserver/home/SlimServer /usr/share/slimserver
# ln -s /mnt/slimserver/etc /etc/slimserver

# ln -s /mnt/slimserver/home/slimserver.init /etc/init.d/slimserver
# ln -s /mnt/slimserver/home/slimserver.config /etc/sysconfig/slimserver

Create directories to house SlimServer installation:

# mkdir /mnt/slimserver/
# mkdir /mnt/slimserver/cache/
# mkdir /mnt/slimserver/etc/
# mkdir /mnt/slimserver/home/
# chown slimserver:slimserver /mnt/slimserver/*

Prepare external MySql server:

# chkconfig --levels 235 mysqld on
# chkconfig --list mysqld
mysqld 0:off 1:off 2:on 3:on 4:off 5:on 6:off
# service mysqld start

# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. ....
mysql> create database slimserver;
mysql> grant all on slimserver.* to 'slimserver'@'localhost' identified by 'slimserver';
mysql> flush privileges;
mysql> quit

# # Verify connection to database. Use MySql commands
# # DROP DATABASE and DROP USER to remove database.
# # SHOW GRANTS and SHOW DATABASES may be useful.

# mysql -u slimserver -p
Enter password:
Welcome to the MySQL monitor. ....
mysql> quit

Now install the SlimServer:

# su - slimserver
$ wget 'http://www.slimdevices.com/downloads/SlimServer_v6.5.1/SlimServer_v6.5.1.tar.gz'
$ tar xzf SlimServer_v6.5.1.tar.gz

$ wget -O slimserver.config 'http://svn.slimdevices.com/*checkout*/trunk/platforms/fedora/SOURCES/slimserver.config?rev=10447'
$ wget -O slimserver.init 'http://svn.slimdevices.com/*checkout*/trunk/platforms/fedora/SOURCES/slimserver.init?rev=10427'

$ # Edit slimserver.config to suit. Mine reads:
$ #
$ # SLIMSERVER_USER="slimserver"
$ # SLIMSERVER_HOME="/mnt/slimserver/home/SlimServer"
$ # SLIMSERVER_CFG="/mnt/slimserver/etc/slimserver.conf"
$ # SLIMSERVER_LOG="/mnt/slimserver/etc/slimserver.log"
$ # SLIMSERVER_ARGS="--daemon --prefsfile=$SLIMSERVER_CFG --logfile=$SLIMSERVER_LOG"

$ # Use a symbolic link to refer to the current version.

$ ln -s SlimServer_v6.5.1 SlimServer
$ ln -s ../home/SlimServer/convert.conf ../etc/convert.conf
$ ln -s ../home/SlimServer/types.conf ../etc/types.conf

$ # Though not necessary, rename some key directories
$ # and files to ensure they're not used.

$ cd SlimServer
$ mv Bin/i386-linux/mysqld Bin/i386-linux/mysqld-UNUSED
$ mv Bin/build-perl-modules.pl Bin/build-perl-modules.pl-UNUSED

Use a local script to allow for interactive testing:

$ cat <<-\EOF > slimserver.sh

. slimserver.config


set -x
$SLIMSERVER_HOME/slimserver.pl --diag --d_server --d_info --d_import --d_sql --d_mysql $SLIMSERVER_ARGS

$ chmod +x slimserver.sh

$ ./slimserver.sh
... ^C to exit ...

$ # Should fail as it attempts to start the embedded
$ # MySql instance (which was renamed above to prevent it
$ # starting). Should proceed far enough to write the
$ # preferences into /mnt/slimserver/etc/slimserver.conf.

Bind to existing MySql instance:

$ vi /mnt/slimserver/etc/slimserver.conf
... Change the following lines ...
dbsource: dbi:mysql:database=slimserver
dbusername: slimserver
dbpassword: slimserver

$ # Verify that the SlimServer can bind to the MySql
$ # instance.

$ ./slimserver.sh
... ^C to exit ...

$ # Repeat until SlimServer runs successfully
$ # for several minutes. Browse to localhost:9000
$ # to verify.
$ # See /mnt/slimserver/etc/slimserver.log.

Install SlimServer service:

$ exit
# chkconfig slimserver reset
# chkconfig --list slimserver
slimserver 0:off 1:off 2:off 3:on 4:on 5:on 6:off

# # Manually start SlimServer with automatic start
# # on reboot.

# service slimserver start

2007-05-06, 18:32
Whilst switching my audio drive to RAID, I noticed thatSlimServer uses the Apple mDNSResponderPosix implementation for mDNS. Fedora is distributed with Avahi from www.avahi.org. The FAQ (http://www.avahi.org/wiki/Avah4users#FAQ) at the Avahi site warns:

Is it OK to run multiple mDNS responders on the same machine?

No, it is not OK. Sooner or later some mDNS features known as "Known Answer Suppression" and "Unicast Reply" (and probably some more) will result in problems if more than one responder runs on the same machine.

At least two potential options present themselves to temporarily patch SlimServer over to Avahi. The first option would be to replace Bin/i386-linux/mDNSResponderPosix with a script that runs avahi-publish. This seems fairly straightforward but I was unhappy that there didn't appear to be a way to remove a published service from the command line (ie there is no avahi-unpublish or -remove command line option).

The second option is to replace Slim/Networking/mDNS.pl with an Avahi version. I think this is the option worth pursuing.

The following RPMs are easily obtained:

extras perl-Net-DBus 0.33.4-3.fc6
dries perl-Net-Rendezvous-Publish 0.04-1.fc6.rf

I could only find these next two from Mandriva (RPMs (http://gulus.usherbrooke.ca/pub/distro/Mandrakelinux/official/2007.1/i586/me
dia/contrib/release) and keys (http://gulus.usherbrooke.ca/pub/distro/Mandrakelinux/official/2007.1/i586/me
dia/contrib/release/media_info)), and the Mandriva dependencies for Perl 5.8.8 are specified in a different way, so in the end I installed these using rpm -i --nodeps:



Once these are installed, the following additional Fedora RPMs are required to satisfy the runtime dependencies:

extras perl-Want 0.12-1.fc6
extras perl-Module-Pluggable 3.10-2.fc6

This is the test program to see if this can successfully publish an entry:

use Net::Rendezvous::Publish;
my $publisher = Net::Rendezvous::Publish->new
or die "couldn't make a Responder object";

my $service1 = $publisher->publish(
name => "My HTTP Server",
type => '_http._tcp',
port => 9000,
txt => '',

my $service2 = $publisher->publish(
name => "My HTTP Server",
type => '_slimhttp._tcp',
port => 9000,
txt => '',

sleep 15;


sleep 15;


sleep 15;

The content of the test program is obtained from cache/mDNS.conf which is written by SlimServer to help configure mDNSResponderPosix.

Kill mDNSResponderPosix using kill -SIGINT before running the test program. Leave SlimServer running.

Whilst the test program is running, I verified its operation using an XP machine with Apple Bonjour for Windows (http://www.apple.com/support/downloads/bonjourforwindows.html). Open the Bonjour toolbar, and select "My HTTP Server" to verify that a connection to the SlimServer starts successfully.

This verifies the proof-of-concept. The next step is to write a replacement for mDNS.pl.

2007-05-07, 09:34
The easiest thing to do for the moment is to create a replacement for mDNS.pm:

% mv mDNS.pm mDNS.pm.orig
% ln -s avahiDNS.pm mDNS.pm

One of the great things about the Avahi replacement is that when SlimServer stops, the service is removed from the Avahi publication list. Previously, mDNSResponderPosix would continue to run, even when SlimServer had been stopped.

Remember to change /etc/init.d/slimserver to reflect the dependency on Avahi. In FC6 avahi-daemon has a chkconfig line of # chkconfig: 345 98 02.

To compensate, I changed /etc/init.d/slimserver to # chkconfig: 345 99 01, and also issued chkconfig slimserver reset to commit the change.

This code implements a suitable replacement:

package Slim::Networking::mDNS;

# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License,
# version 2.

use strict;
use Slim::Utils::Misc;
use Slim::Utils::Prefs;

use Net::Rendezvous::Publish;

my $init = 0;
my $publisher;
my @advertisement = ();
my %services = ();

sub init {
my $class = shift;

$::d_mdns && msg("mDNS: Initializing..\n");

$publisher = Net::Rendezvous::Publish->new(
backend => 'Net::Rendezvous::Publish::Backend::Avahi');

if ($publisher) {
$init = 1;
} else {
$::d_mdns && msg("mDNS: Failed to create responder.\n");

sub addService {
my ($class, $service, $port) = @_;

unless ($init) {
return unless $class->init;

my $name = Slim::Utils::Prefs::get('mDNSname');

if (!defined $name || $name eq '') {

$::d_mdns && msg("mDNS: Blank name, skipping service: $service - TXT - $port\n");

} else {

$::d_mdns && msg("mDNS: Adding service: $name - $service - TXT - $port\n");

$services{$service} = [ $name, $port ];


sub removeService {
my ($class, $service) = @_;

unless ($init) {
return unless $class->init;

$::d_mdns && msg("mDNS: Removing service: $service\n");

delete $services{$service};

sub startAdvertising {
my $class = shift;

unless ($init) {
return unless $class->init;

# Remove any existing services

# Publish each specified service
$::d_mdns && msg("mDNS: startAdvertising()\n");

while (my ($service, $data) = each %services) {

my ($name, $port) = @$data;

push @advertisement, $publisher->publish(
name => $name,
type => $service,
port => $port,
txt => "TXT",

sub stopAdvertising {
my $class = shift;

$::d_mdns && msg("mDNS: stopAdvertising()\n");

while (@advertisement) {



# Local Variables:
# tab-width:4
# indent-tabs-mode:t
# End: