Installing pkgsrc
This page covers installing your own pkgsrc tree, e.g. on Accelerators that came originally with the Blastwave package template (i.e. all binaries under /opt/csw).
Introduction
What's Available?
A searchable FreshPorts-like package browser is at pkgsrc.se. You can use this site to easily search through the thousands of packages available. It may a good idea to use this tool to check whether the packages you’ll need are available to you, before going ahead and installing pkgsrc on your Accelerator.
Installing
Prerequisites
- pkgsrc relies on gcc and a few other tools.
- Take a few moments to read through the documentation if you’re new to pkgsrc.
/opt/local. This is a convention for user installed software on Solaris, and its recommended you do not change this, unless you have good reason.
Installation
First, be sure you’re running as root:
su - [enter root password]
Or, if you’re setup with sudo:
sudo su -
Make sure your path starts with this (Blastwave stuff can follow):
/opt/local/bin:/opt/local/sbin:/usr/xpg4/bin:/usr/bin:/usr/sbin:/usr/sfw/bin:/usr/ccs/bin
Download the latest stable (e.g. pkgsrc-2007Q4) from ftp://ftp.netbsd.org/pub/pkgsrc/, e.g.:
cd /opt && wget ftp://ftp.netbsd.org/pub/pkgsrc/pkgsrc-2007Q4/pkgsrc-2007Q4.tar.bz2
Unpack to /opt/pkgsrc:
cd /opt && gtar -xjf pkgsrc-2007Q4.tar.bz2 && rm pkgsrc-2007Q4.tar.bz2
Bootstrap (this will take a while):
/opt/pkgsrc/bootstrap/bootstrap --prefix=/opt/local CONFIG_SHELL=/usr/bin/bash WRAPPER_SHELL=/usr/bin/bash
Remove dead *.hu-berlin.de” mirror from /opt/pkgsrc/mk/fetch/sites.mk:
gsed -i"" '/informatik\.hu-berlin/d' /opt/pkgsrc/mk/fetch/sites.mk
Run security audit first time:
/opt/local/sbin/download-vulnerability-list >/dev/null 2>&1
Create a Cron job for it:
0 3 * * * /opt/local/sbin/download-vulnerability-list >/dev/null 2>&1
Add these to /opt/local/etc/mk.conf (good bits):
CONFIG_SHELL= /usr/bin/bash WRAPPER_SHELL= /usr/bin/bash PKG_OPTIONS.ruby= ruby-build-ri-db PKG_OPTIONS.apache= suexec PKG_OPTIONS.apr-util= db4 PKG_OPTIONS.postfix= pcre sasl tls PKG_OPTIONS.openssl= idea rc5 PKG_OPTIONS.proftpd= tls
Define CVS env:
CVSROOT="anoncvs@anoncvs.NetBSD.org:/cvsroot" CVS_RSH="ssh" export CVSROOT CVS_RSH
Build CVS (optional, you can also use the version supplied via Blastwave for now):
cd /opt/pkgsrc/devel/scmcvs && bmake install && bmake clean
After the initial installation, boot
Updating package list
To update the directory tree of packages available for you to build:
cd /opt/pkgsrc && cvs -q up -dP
Updating the package list may take several minutes: if you prefer to see what’s being updated, omit the -q flag.
Building packages
Examine the reference documentation, and you should be all set to start building the software for your stack. Use the web-basedpkgsrc package browser to help find your way around the package directory tree.
Next part, the gotchas:
Managing packages
Reviewing what's installed
Pkgsrc also provides you with several tools to manage the packages that you’ve installed. From time to time, you’ll want to check to see whether you have the latest version installed.
To see a full list of packages installed:
pkg_info -a
To see information about a particular package:
pkg_info PACKAGENAME
Review the manpages for pkg_info for a full list of flags and options available.
Checking what's out-of-date
To check for out-of-date packages, you’ll first want to install the lintpkgsrc package. To install:
cd /opt/pkgsrc/pkgtools/pkglint/ && bmake install
Then to check what’s out of date:
root# lintpkgsrc -i Scan Makefiles: 6988 packages Version mismatch: 'ImageMagick' 6.3.5.10 vs 6.3.6.1 Version mismatch: 'apr' 0.9.16.2.0.61 vs 1.2.12,0.9.17.2.0.63 Version mismatch: 'apr-util' 1.2.8nb1 vs 1.2.10 Version mismatch: 'asciidoc' 8.1.0nb2 vs 8.2.5nb1 Version mismatch: 'bootstrap-mk-files' 20070810 vs 20071104 Version mismatch: 'curl' 7.17.0 vs 7.17.1 Version mismatch: 'gawk' 3.1.5nb1 vs 3.1.6 Version mismatch: 'gettext' 0.14.6 vs 0.14.6nb1
Diskspace usage
After each install, working files are left behind. You can either execute bmake clean or bmake clean-depends after each compilation.
If you have remants throughout the package tree, you can use the pkgclean tool, installable as follows:
cd /opt/pkgsrc/pkgtools/pkgclean/ && bmake install