Setting up Catalyst environments with pkgsrc

This article will deal with installing a Catalyst environment with the NetBSD Package Collection. It will show you how to install an environment on a Solaris 9 Sparc box and will briefly show you how pkgsrc works.

Introduction

pkgsrc was been introduced in 1997 to the NetBSD project. It's a fork of the FreeBSD ports system. pkgsrc for NetBSD follows the same goals as the NetBSD project itself which is portability, portability, and...you know it already. The basic design was heavily modified over time and pkgsrc has steadily advanced. The first toolchain hack of pkgsrc was made in 1999 in order to support Solaris. In these days pkgsrc has become a quite stable package management tool for all your third-party software needs on all kind of different platforms and operating systems. About 15 operating systems are supported, but we'll demonstrate it on Solaris 9/sparc.

Catalyst on Solaris 9/sparc

In this small example we'll install a Catalyst environment on a Solaris 9/sparc server. This machine has a pretty decent support for pkgsrc and prebuilt binary packages, so getting started with Catalyst is quick. Setting up a basic environment for SUN Solaris using pkgsrc is quite easy and isn't very time consuming. Just follow the steps described below in order to set up your environment for pkgsrc , which allows you to install the binary packages for Catalyst.

Bootstrapping pkgsrc

The basic bootstrap kit for pkgsrc contains the necessary tools and a small package database. By installing this kit you prepare your SUN Solaris server to use pkgsrc with all its capabilities.

Just download the kit from:

 ftp://ftp.netbsd.org/pub/pkgsrc/packages/SunOS/sparc/5.9_2008Q3/\
 bootstrap-pkgsrc-SunOS-5.9-sparc-2008Q3.tar.gz

Gunzip and untar this package as the root user to the root directory of your system. It will leave you with a small everything installed to /usr/pkg and /var/db .

In order to use the pkgsrc binaries several changes to your environment have to be made. pkgsrc uses its own directories for the software which is to be installed. However, Solaris doesn't know about the paths which are used by pkgsrc , so they need to be added to the environment. I usually set them in /etc/profile and /etc/.login. To set up the environment for sh/ksh shells (/etc/profile):

   PATH=/usr/pkg/bin:/usr/pkg/sbin:$PATH
   MANPATH=/usr/pkg/man:$MANPATH
   export PATH MANPATH

If you would like to use a different server for your binaries, make sure to add the PKG_PATH variable to your favorite package location. For sunpkg.de and Solaris 9 on sparc architectures this would be:

   PKG_PATH=http://ftp.netbsd.org/pub/pkgsrc/packages/SunOS/sparc\
           /5.9_2008Q3/All
   export PKG_PATH

Just add this to /etc/profile .

Before we get started, we need to reload the profile in order to set the correct PATH, MANPATH, and PKG_PATH information.

   . /etc/profile

The installation of the pkgsrc bootstrap kit is now finished.

Installation of Catalyst

The basic installation of the Catalyst package is quite simple. Just type:

 pkg_add p5-Catalyst-Devel

pkgsrc will automatically find the package, download it, and fetch all the dependencies and install them.

Manual installation

The bootstrap proccess can be run manually to choose different installation paths. Please refer to the manual to get started. The advantage of using the prebuilt binaries is to save lots of time on slower Solaris machines.

The advantage to bootstrap manually is to specify the installation path. pkgsrc will take care of everything automatically so you can have a fully working installation managed by pkgsrc inside your home directory. This makes it easy to set up Catalyst in a situation where you have limited rights on a system, or to ship your application inside a path where the customers want you to install.

More information

The NetBSD community tries very hard to keep everything up-to-date. However, pkgsrc uses 3 month release cycles which leave packages a bit behind. If you want to test out the latest stuff, make sure to use the -current branch of pkgsrc .

Here are some links which helps you to keep everything working:

The NetBSD Packages Collection (http://www.pkgsrc.org)

The NetBSD pkgsrc guide (http://www.netbsd.org/docs/pkgsrc/index.html)

A nice webinterface to pkgsrc (http://www.pkgsrc.se)

Check for out-of-date packages (http://www.pkgbox.org/p2c/)

Happy installing!

Ulrich Habel <rhaen[at]NetBSD.org>