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

OpenBSD installation guide

From SqueezeboxWiki

Revision as of 06:01, 2 March 2012 by Wildnet (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

Introduction

These instructions are based on using [OpenBSD] 5.0 and Logitech Media Server (formerly know as SqueezeCenter and Squeezebox Server) 7.7.1 but they should work (with interpolation and ports/package updates) under other versions as well.

One important point to be aware of is that LMS includes all required CPAN modules with its distribution. This includes some custom patched versions of these modules. There are also pre-built shared objects for several OSes for those CPAN modules that require them.

One method of installing LMS is to move aside all these included CPAN modules and install system level versions. This is the method described in previous versions of this page. I tried this as well and ran into several problems. In the end I got LMS to startup but it was flaky and needed more work. I'll describe that method later on this page.

The alternative, and the recommended method I believe, is to just get LMS up and running with the included CPAN modules. Since OpenBSD isn't one of the OSes that has pre-built libraries we'll have to build them ourselves.

Note that what I describe below _seems_ to work. I haven't hit any major problems or failures yet, but, caveat emptor.

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 5.0 on an i386 system) see this:

ftp://ftp.usa.openbsd.org/pub/OpenBSD/5.0/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.

User/Group

Add a user/group for the server. I called mine _logmediasrv but use whatever you like. Ensure that the user doesn't have a password and can't login. When you are done it should look something like:

-bash-4.2$ userinfo _logmediasrv
login   _logmediasrv
passwd  *
uid     600
groups  _logmediasrv
change  NEVER
class   daemon
gecos   Logitech Media Server
dir     /home/_logmediasrv
shell   /sbin/nologin
expire  NEVER

At this point I tend to delete the home directory that is automatically created (I haven't figured out how to stop it) at /home/_logmediasrv and point the home directory to /var/empty

sudo usermod -d /var/empty _logmediasrv
sudo rm -rf /home/_logmediasrv

Extraction

Extracted to /usr/local/sbin

cd /usr/local/sbin
sudo tar xzvf /tmp/logitechmediaserver-7.7.1.tgz

After extraction the file/directory permissions are a little draconian. So give read access to others. From /usr/local/sbin

sudo chmod 755 logitechmediaserver-7.7.1-33735
sudo chmod -R 664 logitechmediaserver-7.7.1-33735/*
sudo find logitechmediaserver-7.7.1-33735 -name *.pl -exec chmod 755 {} \;
sudo find logitechmediaserver-7.7.1-33735 -type d -exec chmod 755 {} \;

Finally LMS requires some writable directories to store preferences, databases and such. I put mine in /var/lms and provide symlinks to them.

sudo mkdir /var/lms
sudo mkdir /var/lms/prefs
sudo mkdir /var/lms/cache
sudo mkdir /var/lms/logs
sudo find /var/lms -type d -exec chown _logmediasrv {} \;
sudo find /var/lms -type d -exec chmod 755 {} \;

cd /usr/local/sbin/logitechmediaserver-7.7.1-33735
sudo ln -s /var/lms/prefs prefs
sudo ln -s /var/lms/cache Cache
sudo ln -s /var/lms/logs Logs

Building Modules

All the required code and a handy shell script are available from Logitech's SVN repository. We'll start with that code and make a few changes to make it build on OpenBSD. First you'll need to install a couple of packages if you haven't already. The build scrip requires gmake and rsync.

sudo pkg_add gmake rsync bash yasm

Make yourself a temporary directory and download the source.

mkdir /tmp/lms
cd /tmp/lms
svn co http://svn.slimdevices.com/repos/slim/7.7/tags/7.7.1/vendor/CPAN

Here is a tarball with the required patches. Extract it to the CPAN directory that the svn command above created. You'll have to manually patch buildme.sh yourself, but after that the others will be applied automatically.

patch -p0 < buildme.sh.patch

At this point you should be ready to build the required modules. Just start the buildme script with no arguments and come back in a while.

./buildme.sh

If all goes well it will compile with no problems. What you are after is in the build directory that is created. Copy it into wherever you installed LMS.

32-bit version:

sudo cp -R build/arch/5.12/i386-openbsd /usr/local/sbin/logitechmediaserver-7.7.1-33735/CPAN/arch/5.12

64-bit version:

sudo cp -R build/arch/5.12/amd64-openbsd /usr/local/sbin/logitechmediaserver-7.7.1-33735/CPAN/arch/5.12


Final Steps

At this point LMS should be ready to start. Give it a try:

sudo -u _logmediasrv perl /usr/local/sbin/logitechmediaserver-7.7.1-33735/slimserver.pl

It should start and print a bunch of stuff to the console. Assuming it doesn't crash try browsing to the webserver found at whatever IP address your host machine is using and port 9000. Logitech Media Server's setup wizard should take it from here.

Assuming the above worked the last thing to do is to create a startup script. Create a file called logmediasrv in the /etc/rc.d directory with the following contents.

#!/bin/sh

daemon="/usr/bin/perl /usr/local/sbin/logitechmediaserver-7.7.1-33735/slimserver.pl"
daemon_flags="--daemon"
daemon_user="_logmediasrv"

. /etc/rc.d/rc.subr

rc_reload=NO

rc_cmd $1

Then just add logmediasrv to pkg_scripts in your rc.conf.local file.