Home of the Squeezebox™ & Transporter® network music players.

OpenBSDInstallationGuide

From SqueezeboxWiki

Jump to: navigation, search

Contents

Introduction

These instructions are based on using [OpenBSD] 4.3 and SqueezeCenter 7.0.1 but they should work (with interpolation and ports/package updates) under other versions as well.

Following this guide, we'll set up our build environment, add packages and ports necessary for slimserver.pl to run, then fire up the SqueezeCenter under an account dedicated to running slimserver.pl.

Environment

First, set up your environment for smooth package adding and port building. If you're in ksh or bash, do:

export PKG_PATH="ftp://ftp.usa.openbsd.org/pub/OpenBSD/`/usr/bin/uname -r`/packages/`/usr/bin/uname -m`/"

export CVSROOT=anoncvs@anoncvs.usa.openbsd.org:/cvs

If you're in csh or tcsh, do:

setenv PKG_PATH "ftp://ftp.usa.openbsd.org/pub/OpenBSD/`/usr/bin/uname -r`/packages/`/usr/bin/uname -m`/"

setenv CVSROOT anoncvs@anoncvs.usa.openbsd.org:/cvs

In those commands, especially if you're not in the USA, you might want to swap ftp.usa.openbsd.org for another netwise-close [OpenBSD ftp mirror] and switch anoncvs.usa.openbsd.org for another netwise-close [OpenBSD Anonymous CVS server].

Confirm that the results are reasonable for your release (uname -r) and architecture (uname -m) this way.

echo $PKG_PATH

You will most likely (in OpenBSD 4.3 on an i386 system) see this:

ftp://ftp.usa.openbsd.org/pub/OpenBSD/4.3/packages/i386/

With that environment set up, you'll be able to quickly and easily add the packages and build the ports necessary for SqueezeCenter.

Packages

SqueezeCenter needs certain software in order to run. The best (quickest and most sure) way to add these to your OpenBSD system is via OpenBSD's pre-built packages. Following these instructions, you will add any necessary packages you didn't already have, then update any you already have installed.

Package Add

Add the packages with the pkg_add command. It will honor the PKG_PATH environment variable you set earlier for any packages that aren't already on your system.

sudo pkg_add curl wget mysql-server p5-Compress-Zlib p5-DBD-mysql p5-Digest-SHA1 p5-Module-Build p5-HTML-Parser p5-Template p5-YAML-Syck

Package Update

Now update any packages you already had installed to the most recent version available in the package system.

sudo pkg_add -u curl wget mysql-server p5-Compress-Zlib p5-DBD-mysql p5-Digest-SHA1 p5-Module-Build p5-HTML-Parser p5-Template p5-YAML-Syck

You now have most of what you need to run slimserver.pl. What remains are some additional ports not yet available as packages, and extracting plus adjusting the SqueezeCenter release.

Ports

SqueezeCenter requires some software that isn't yet available as a pre-built package for your OpenBSD system. You'll need to add these via the ports system.

Some of the necessary ports are referenced by this page as tarred and gzipped archives. Download the following to /tmp now, so you can follow the commands in the sections below to build them.

http://www.river.com/users/share/p5-GD-2.39-port.tar.gz http://www.river.com/users/share/p5-Encode-Detect-1.01-port.tar.gz

Others are in OpenBSD-current, so you'll check them out with CVS.

Ports Tree

Follow the [OpenBSD instructions] for checking out and updating a [stable release ports tree]. You must have /usr/ports populated with the the OPENBSD_4_3 branch of the ports.

If you already have /usr/ports checked out, update it for OpenBSD 4.3 this way.

cd /usr/ports && cvs -d $CVSROOT -q up -rOPENBSD_4_3 -Pd

If you do not have /usr/ports checked out, get the OpenBSD 4.3 checkout this way.

cd /usr && cvs -d $CVSROOT -q co -rOPENBSD_4_3 ports

Port Installation

These commands will extract, build, install and clean the remaining ports you need to run slimserver.pl.

Auxiliary Ports

p5-Encode-Detect

The p5-Encode-Detect port is not in OpenBSD 4.3 or OpenBSD-current. Install it thusly.

cd /usr/ports/converters && tar xzvf /tmp/p5-Encode-Detect-1.01-port.tar.gz && cd /usr/ports/converters/p5-Encode-Detect && env CLEANDEPENDS=yes make install clean

p5-GD

The p5-GD port is in OpenBSD-current, but installs an older version than the version slimserver.pl requires. Install the newer version thusly.

cd /usr/ports/graphics && tar xzvf /tmp/p5-GD-2.39-port.tar.gz && cd /usr/ports/graphics/p5-GD-2.39 && env CLEANDEPENDS=yes make install clean

Optional Cleanup

If you wish, remove the port tree additions. This will avoid warnings as you cvs update your /usr/ports tree in the future.

rm -rf /usr/ports/converters/p5-Encode-Detect rm -rf /usr/ports/graphics/p5-GD-2.39

Ports from OpenBSD-current

p5-JSON-XS

The p5-JSON-XS port will very likely be in the OpenBSD 4.4 release, and available as a package. For now on OpenBSD 4.3, though, get and build the OpenBSD-current version thusly.

cd /usr/ports/converters && cvs -d $CVSROOT -q up -PAd p5-JSON-XS && cd p5-JSON-XS && env CLEANDEPENDS=yes make install clean

Optional Cleanup

After it's installed, if you wish, you can switch your p5-GD checkout back to the OPENBSD_4_3 branch. This will avoid potential inconsistencies as you cvs update your /usr/ports tree in the future.

cd /usr/ports/converters && cvs -d $CVSROOT -q up -rOPENBSD_4_3 -Pd p5-JSON-XS

You now have even more of what you need to run slimserver.pl. What remains is extracting plus adjusting the SqueezeCenter release.

Firing It Up

We have now installed everything we need to run SqueezeCenter. It's time to extract and fix it up for running.

User Creation

We'll run slimserver.pl under an account dedicated to that purpose.

With the adduser command, create a user we can dedicate to running slimserver.pl. This user will never log in directly (we will always sudo -u or the like to it when we need to be this user), so lock the password. Once added, the account should look something like this

$ userinfo _slimsrv
login   _slimsrv
passwd  *
uid     7546
groups  _slimsrv
change  NEVER
class   daemon
gecos   Slim Devices SqueezeCenter
dir     /home/_slimsrv
shell   /bin/ksh
expire  NEVER

SqueezeCenter Extraction

With the dedicated user created, we're ready to fetch and set up the SqueezeCenter.

Download the SqueezeCenter software (squeezecenter-7.0.1.tar.gz) and put a copy in /tmp/.

Become the _slimsrv user.

sudo su - _slimsrv

Extract the server software into the _slimsrv home directory.

tar xzpvf /tmp/squeezecenter-7.0.1.tar.gz

With the server archive extracted, you're now ready to clean up a last few gotchas.

SqueezeCenter Adjustment

The SqueezeCenter distribution we just extracted arrives almost ready to go. You'll just need to make a couple of adjustments to the included CPAN directory and the MySQL error message file.

CPAN Directory

The CPAN directory in the SqueezeCenter distribution is preferred by slimserver.pl for header info. This can cause mismatch problems when running the Perl modules installed earlier. The quickest fix is to hide the squeezecenter-7.0.1/CPAN subdirectory.

mv squeezecenter-7.0.1/CPAN squeezecenter-7.0.1/CPAN-unused

An alternative fix is to remove the subdirectories in CPAN that cause immediate problems, though this may leave other problems for later. Those include at least the following issues: YAML::Syck (symptom: cannot find YAML::Syck::Dump), Encode::Detect::Detector (symptom: bootstrap parameter version from CPAN directory is 1.00, installed is 1.01), Template (symptom: bootstrap parameter version from CPAN directory is old again).

rm -r squeezecenter-7.0.1/CPAN/YAML squeezecenter-7.0.1/CPAN/Encode CPAN/Template squeezecenter-7.0.1/CPAN/Template.pm

MySQL error message file

SqueezeCenter includes a MySQL errmsg.sys that doesn't match what's installed on the system. Move the SqueezeCenter one out of the way, and link in the one from the port.

mv squeezecenter-7.0.1/MySQL/errmsg.sys MySQL/errmsg.sys-orig && ln -s /usr/local/share/mysql/english/errmsg.sys squeezecenter-7.0.1/MySQL/errmsg.sys

With those adjustments, you're ready to run slimserver.pl for the first time.

Start It Up

Run slimserver.pl in the foreground, and watch the startup messages.

env PATH=${PATH}":/usr/local/libexec" /home/_slimsrv/squeezecenter-7.0.1/slimserver.pl --

You may see notices from PluginManager::enablePlugins and mDNS::startAdvertising not being able to run. These warnings empirically do not affect an OpenBSD server.

Contrary to the advice in Installation.txt (apparently this is left over from SlimServer 6.X), your preferences will by default be stored in /home/_slimsrv/squeezecenter-7.0.1/prefs/server.prefs. When upgrading to 7.1 or newer, you may wish to copy this file to the newer installation, but check the release notes for compatibility.

Debugging If Necessary

If you encounter problems, you might try various debug modes. For example, to turn on debugging of the startup process, try

env PATH=${PATH}":/usr/local/libexec" /home/_slimsrv/squeezecenter-7.0.1/slimserver.pl --d_startup

For server debugging, try

env PATH=${PATH}":/usr/local/libexec" /home/_slimsrv/squeezecenter-7.0.1/slimserver.pl--d_server

Automatic Startup

Once you have slimserver.pl running to your satisfaction, add the following to /etc/rc.local below "# Add your local startup actions here" to start slimserver.pl automatically at system boot.

if [ -x /home/_slimsrv/squeezecenter-7.0.1/slimserver.pl ]; then
  echo -n ' squeezecenter-7.0.1'
  sudo -u _slimsrv env PATH=$PATH":/usr/local/libexec" \
  /home/_slimsrv/squeezecenter-7.0.1/slimserver.pl --daemon
fi

Conclusion

You've installed the necessary prerequisites for running slimserver.pl, and successfully fired it up. Congratulations!

Now visit http://{yourhost}:9000/, configure SqueezeCenter, and start listening.

Future Work

If you have the time, familiarize yourself with [OpenBSD ports development], and create a port plus package based on the above info for SqueezeCenter 7.1.

If you have less time, update the above for SqueezeCenter 7.1 by finding or producing packages/ports for the new software required by 7.1.