<?sphp $this->text('pagetitle') ?>
Home of the Squeezebox™ & Transporter® network music players.


From SqueezeboxWiki

Jump to: navigation, search


SqueezeCenter Installation on OpenSolaris

The steps to follow to install SqueezeCenter on the latest release of OpenSolaris are a little different from those listed in the more generic Solaris_Installation_Guide. The good news is that mostly they are simpler. You do not need to download any "non-standard" packages from Blastwave: the stock Perl and MySQL delivered by the [OpenSolaris Web Stack project] work just fine. Below are the detailed steps to follow to install SqueezeCenter 7.1 on OpenSolaris.

Specific Version Information

If you are running OpenSolaris 2008.05 and have not updated, you should. It's easy! You can still run SqueezeCenter, but you will need to deal with a couple of OpenSolaris 2008.05 specific things.

Commands in this Guide

Rather than type pfexec all the time, for the rest of the instructions we're going to assume you have assumed the root role. You can do that with pfexec by running a shell under pfexec. You may want to verify your user can assume the root role first with the roles command. You should be able to if this is the user you created during install or you added permissions when creating the user:

jack@opensolaris:~$ roles
jack@opensolaris:~$ pfexec bash

Note the prompt has changed to reflect your new role.

Configure DHCP client

Although OpenSolaris has DHCP turned on when you install it, by default, the OS does not supply its host name to the DHCP router from which it obtains its IP address. This means that other machines on the network can’t contact it by name alone. A couple of config changes can fix this though.

You first need to know the name of your network interface. This varies from machine to machine as the interfaces are named after their drivers, but can easily be seen from the output of the ifconfig command. (Just ignore the loopback interfaces.) Eg:

jack@opensolaris:~#  ifconfig -a 
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
 	inet netmask ff000000  
e1000g0: flags=201004843<UP,BROADCAST,RUNNING,MULTICAST,DHCP,IPv4,CoS> mtu 1500 index 2
 	inet netmask ffffff00 broadcast 
lo0: flags=2002000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv6,VIRTUAL> mtu 8252 index 1
 	inet6 ::1/128  

Next step is to edit the file /etc/default/dhcpagent (which you need to be root to do). Find the following block:

# By default, the DHCP agent does not send out a client identifier 
# (and hence, the chaddr field is used by the DHCP server as the 
# client identifier.)  To make the DHCP agent send a client 
# identifier, set and uncomment the following parameter-value pair. 
# Note that by default this is treated as an NVT ASCII string.  To 
# specify a binary value, prepend "0x" to a sequence of hexadecimal 
# digits (for example, the value 0xAABBCC11 would set the client 
# identifier to the 4-byte binary sequence 0xAA 0xBB 0xCC 0x11). 

# By default, the DHCP agent will try to request the hostname currently 
# associated with the interface performing DHCP.  If this option is 
# enabled, the agent will attempt to find a host name in /etc/hostname.<if>, 
# which must contain a line of the form 
#       inet name 
# where "name" is a single RFC 1101-compliant token.  If found, the token 
# will be used to request that host name from the DHCP server.  To prevent 
# this, uncomment the following line.

Then uncomment and edit the two lines marked bold above to say:


Where <hostname> is the name of the machine.

Then follow the instructions in the comment above the REQUEST_HOSTNAME directive. This is where you need the interface name obtained from ifconfig. (Note that, after the su command below, we stay as root to do the rest of the configuration/install.) Eg:

jack@opensolaris:~# vi /etc/default/dhcpagent 
jack@opensolaris:~# ls /etc/hostname* 
/etc/hostname*: No such file or directory 
jack@opensolaris:~# echo "inet $(hostname)" >> /etc/hostname.e1000g0

Since DHCP configuration changes have been made, you need to get the server to re-request its DHCP info from the DHCP server. This involves running the following commands as root on the console or desktop of the system itself (rather than being remotely logged in).

jack@opensolaris:~# svcadm restart nwam

Finally, check that the /etc/nsswitch.conf file is correctly configured to use DNS (rather than just /etc/hosts) for host lookups. You should see something similar to the following if the OpenSolaris Network Automagic is working as expected:

jack@opensolaris:~# grep ^host /etc/nsswitch.conf 
hosts: files dns # Added by DHCP

The word "dns" should appear there.

Add Unix Groups/Users

The user and group for mysql will be created when you install the MySQL package from OpenSolaris's package repository but you may wish to add a slimsrv group and user. You can either do this through the GUI or create a user account which can't actually log in at the command line.

jack@opensolaris:~# groupadd slimsrv
jack@opensolaris:~# useradd -s /bin/false -g slimsrv -c "SqueezeCenter User" slimsrv

Install and configure MySQL

Now could be a good time to capture your system state in case you want to return to this configuration later. If so, you may wish to create a new boot environment and reboot to it. You can do this with the beadm(1M) command.

Either install MySQL through the Package Manager GUI (System -> Administration -> Package Manager) or from the command line.

jack@opensolaris:~# pkg install SUNWmysql51 SUNWmysql51lib

Assume the id of the MySQL user and initialize the database tables:

jack@opensolaris:~# su - mysql
$ bash
bash-3.2$ id
uid=70(mysql) gid=70(mysql)
bash-3.2$ /usr/mysql/5.1/bin/mysql_install_db                            
Installing MySQL system tables...
090822 10:13:44 [Warning] option 'thread_stack': unsigned value 65536 adjusted to 131072
090822 10:13:44 [Warning] option 'thread_stack': unsigned value 65536 adjusted  to 131072
Filling help tables...
090822 10:13:44 [Warning] option 'thread_stack': unsigned value 65536 adjusted to 131072
090822 10:13:44 [Warning] option 'thread_stack': unsigned value 65536 adjusted  to 131072
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
To do so, start the server, then issue the following commands:
/usr/mysql/5.1/bin/mysqladmin -u root password 'new-password'
/usr/mysql/5.1/bin/mysqladmin -u root -h shorter password 'new-password'
Alternatively you can run:
which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with: 
cd /usr/mysql/5.1 ; /usr/mysql/5.1/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql/5.1/mysql-test ; perl mysql-test-run.pl
Please report any problems with the /usr/mysql/5.1/bin/mysqlbug script!
The latest information about MySQL is available at http://www.mysql.com/
Support MySQL by buying support/licenses from http://shop.mysql.com/

Exit out of the mysql user ID and as your user who has assumed the root role enable the OpenSolaris MySQL service through SMF so we can configure the users and database for use with SqueezeCenter:

bash-3.2$ exit
$ exit
jack@opensolaris:# svcs -a | grep mysql

disabled Jun_13 svc:/application/database/mysql:version_51 disabled 10:12:20 svc:/application/database/mysql:version_50

jack@opensolaris:~# svcadm enable database/mysql:version_51

Now that the daemon is running configure the user and database (substituting a password of your own choosing for "<MysqlAdminPassword>"):

jack@opensolaris:~# /usr/mysql/5.1/bin/mysqladmin -u root password '<MySqlAdminPassword>'
jack@opensolaris:~# /usr/mysql/5.1/bin/mysqladmin -u root -p -h $(hostname) password '<MySqlAdminPassword>'
Enter password: <MySqlAdminPassword>

Now login to the MySQL monitor to create the Squeezecenter database (substituting a password of your own choosing for "<MySqueezePassword>"):

jack@opensolaris:~# /usr/mysql/5.1/bin/mysql -u root -p
Enter password: <MySqlAdminPassword>
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 39
Server version: 5.0.41 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> create database squeezecenter;
Query OK, 1 row affected (0.01 sec)

mysql> grant all on squeezecenter.* to squeezecenter identified by '<MySqueezePassword>';
Query OK, 0 rows affected (0.04 sec)

mysql> grant all on squeezecenter.* to 'squeezecenter'@'localhost' identified by '<MySqueezePassword>';
Query OK, 0 rows affected (0.00 sec)

mysql> quit

Install other packages (Sun compilers, GCC, LibGD, FreeType, FLAC, etc)

Enter the following:

jack@opensolaris:~# pkg install SUNWgcc sunstudioexpress SUNWtoo SUNWgd2 SUNWfreetype2 SUNWgnu-libiconv SUNWflac
jack@opensolaris:~# ln -s /usr/gnu/lib/libiconv.so.2 /usr/lib/libiconv.so.2

Install Additional Perl Packages

By default, Perl 5 is installed on OpenSolaris. We just need to install some additional packages. Some of the packages won't install without the "force" option and one needs its "make" parameters changed, but they all seem to work well enough for SqueezeCenter to run. Type the following. If this is the first time invoking CPAN, you will need to configure it or go with autoconfigure. You should be able to follow the prompts.

You may wish to try to carry out these instructions without modifying the perl CPAN compilation settings, but if you encounter compilation errors that look like this:

cc: unrecognized option `-KPIC'
cc: language ildoff not recognized
cc: ReadKey.c: linker input file unused because linking not done

You'll need to tell cpan to run make with compiler options that are understood by the Sun compiler (cc). edit /usr/perl5/5.8.4/lib/i86pc-solaris-64int/Config.pm and change the optimize and cccdlflags lines to:

cccdlflags=' '

We will put the MySQL binaries in the path and change the path so the default cc is the Sun Studio compiler. Note that the CPAN script may run assuming the userid you've assumed the root role from, and during it's make test it will try to connect to the test database. Follow the instructions given during the install of DBD::mysql to set up the test access to the database. Note that with 4.010, it says it will use a password during test but actually does not use the password when testing.

Also, note that GD requires some special handling to get the right includes and linking with libiconv.so.2. It also seems to require a particular version, giving an error message of "GD (loaded 2.35, need 2.35)", when using a newer version of GD.

Carry out the CPAN installation as follows:

jack@opensolaris:~# export PATH=/opt/SunStudioExpress/bin:/usr/mysql/5.1/bin:$PATH
jack@opensolaris:~# /usr/perl5/bin/perl -MCPAN -e 'shell'
cpan> install Bundle::CPAN
...  (accept many, many dependencies)
cpan> reload cpan
199 subroutines redefined
cpan> install Term::ReadKey
cpan> install Scalar::Util
cpan> install DBI::DBD
cpan> install Bundle::DBI
cpan> install AppConfig
cpan> install DBI
cpan> install DBD::mysql
cpan> install Compress::Zlib
cpan> look L/LD/LDS/GD-2.44.tar.gz

Edit the Makefile.PL to remove the "-Wformat=0"

bash-3.2# perl Makefile.PL 
bash-3.2# make
bash-3.2# make install
bash-3.2# exit
cpan> q
Lockfile removed.

Install SqueezeCenter

Go to a directory where you store downloads and run the following commands (note, you should always check downloads.slimdevices.com for the most recent version (though new workarounds or issues may present themselves):

jack@opensolaris:~# wget http://downloads.slimdevices.com/SqueezeCenter_v7.3.3/squeezecenter-7.3.3.tgz
10:25:59 (112.23 KB/s) - `squeezecenter-7.3.3.tgz' saved [34703870/34703870]

jack@opensolaris:~# gzcat squeezecenter-7.3.3.tgz | tar xvf -
jack@opensolaris:~# mkdir /usr/local 2>/dev/null
jack@opensolaris:~# mv squeezecenter-7.3.3 /usr/local
jack@opensolaris:~# ln -s /usr/local/squeezecenter-7.3.3 /usr/local/squeezecenter
jack@opensolaris:~# ln -s /usr/local/squeezecenter /usr/local/slimserver
jack@opensolaris:~# cd /usr/local/squeezecenter
jack@opensolaris:~# export PATH=$PATH:/usr/mysql/5.0/bin
jack@opensolaris:~# cd Slim/Utils/
jack@opensolaris:~# cp Unicode.pm Unicode.pm.bak
jack@opensolaris:~# cat Unicode.pm.bak | sed 's/use Encode::Detect/#use Encode::Detect/g' > Unicode.pm
jack@opensolaris:~# diff Unicode.pm Unicode.pm.bak
< #use Encode::Detect::Detector;
> use Encode::Detect::Detector;
jack@opensolaris:~# cd -
jack@opensolaris:~# cd Bin
jack@opensolaris:~# cp build-perl-modules.pl build-perl-modules.pl.bak
jack@opensolaris:~# cat build-perl-modules.pl.bak | grep -v Encode::Detect > build-perl-modules.pl
jack@opensolaris:~# diff build-perl-modules.pl build-perl-modules.pl.bak
>       'Encode::Detect'     => 'Encode-Detect-1.00.tar.gz',
jack@opensolaris:~# cd -
jack@opensolaris:~# ./Bin/build-perl-modules.pl
Please enter a perl binary to use (defaults to /usr/bin/perl)
This must be the same perl binary that you ran this program with -->
Please enter a directory to download files to --> /var/tmp
Downloads will use lwp to fetch tarballs.
All done!

jack@opensolaris:~# mkdir cache
jack@opensolaris:~# mkdir Logs
jack@opensolaris:~# mkdir -p prefs/plugin
jack@opensolaris:~# cd MySQL/
jack@opensolaris:~# mv errmsg.sys errmsg.sys.bak
jack@opensolaris:~# cp /usr/mysql/5.0/share/mysql/english/errmsg.sys .
jack@opensolaris:~# cd -
jack@opensolaris:~# touch slimrun
jack@opensolaris:~# chmod a+x slimrun
jack@opensolaris:~# chown -R slimsrv:slimsrv /usr/local/squeezecenter* /usr/local/slimserver

Now edit /usr/local/squeezecenter/slimrun to contain the following (with /path/to/music changed as appropriate):


export PATH

/usr/local/squeezecenter/slimserver.pl --cachedir=/usr/local/squeezecenter/cache --user=slimsrv --group=slimsrv --audiodir=/path/to/music --pidfile=/usr/local/squeezecenter/cache/squeezecenter.pid $*

This script now needs to be run once to generate the default preferences file, which then needs to be edited:

jack@opensolaris:~# ./slimrun
jack@opensolaris:~# cp prefs/server.prefs prefs/server.prefs.default
jack@opensolaris:~# grep ^db prefs/server.prefs
dbsource: dbi:mysql:hostname=;port=9092;database=%s
dbusername: slimserver

We now need to edit this to put the actual database connection parameters in. First check the actual MySQL port and socket values:

jack@opensolaris:~# /usr/mysql/5.0/bin/mysql_config --port --socket

Now edit the prefs/server.prefs file to change the lines beginning db to the following (substituting the password your chose above for "<MySqueezePassword>" and the actual port and socket values if they differ from the sample output immediately above):

dbpassword: '<MySqueezePassword>'
dbsource: dbi:mysql:hostname=localhost;port=3306;database=squeezecenter;mysql_socket=/tmp/mysql.sock
dbusername: squeezecenter

Autostart with Service Management Facility (SMF)

(The following comes from [1] and Solaris_Installation_Guide.) Create a manifest for SqueezeCenter:

jack@opensolaris:~# cat <<EOF > /var/svc/manifest/application/squeezecenter.xml
<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<service_bundle type='manifest' name='squeezecenter'>
  <service name='application/squeezecenter' 
    <create_default_instance enabled='false'/>
    <dependency name='name-services' 
      <service_fmri value='svc:/milestone/name-services' />
    <dependency name='network' 
      <service_fmri value='svc:/milestone/network' />
    <dependency name='local-filesystems' 
      <service_fmri value='svc:/system/filesystem/local' />
    <exec_method type='method' 
                 exec='/usr/local/squeezecenter/slimrun --daemon'
                 timeout_seconds='30' />
    <exec_method type='method' 
                 timeout_seconds='30' />
    <stability value='Unstable' />
        <loctext xml:lang='C'>SqueezeCenter</loctext>
        <doc_link name='SlimDevices Home' uri='http://www.slimdevices.com/'/>

Finally, import the new manifests:

jack@opensolaris:~# svccfg import /var/svc/manifest/application/squeezecenter.xml
jack@opensolaris:~# svcadm enable application/database/mysql
jack@opensolaris:~# svcadm enable squeezecenter

New Boot Environment post-install

If everything is tested and working fine, this may be another good time to create a new boot environment you can recover to. The command for this is beadm(1M).