The NetBSD Packages Collection (pkgsrc) is a framework for building third-party software on NetBSD and other UNIX-like systems, currently containing over 5500 packages. It is used to enable freely available software to be configured and built easily on supported platforms.
|
Latest stable branch: pkgsrc-2005Q4
Latest news
Pre-compiled binaries for supported platformsOther downloads
|
The following mailing lists may be of interest to pkgsrc users:
pkgsrc provides the following key features:
pkgsrc consists of both a Source distribution and a Binary distribution for these operating systems. After retrieving the required source or binaries, you can be up and running with pkgsrc in just minutes!
Table 1. Platforms supported by pkgsrc
Platform | Date Support Added |
---|---|
NetBSD | Aug 1997 |
Solaris | Mar 1999 |
Linux | Jun 1999 |
Darwin (Mac OS X) | Oct 2001 |
FreeBSD | Nov 2002 |
OpenBSD | Nov 2002 |
IRIX | Dec 2002 |
BSD/OS | Dec 2003 |
AIX | Dec 2003 |
Interix (Microsoft Windows Services for Unix) | Mar 2004 |
DragonFlyBSD | Oct 2004 |
OSF/1 | Nov 2004 |
If you are using NetBSD, you can get started with pkgsrc right away. Skip ahead to Installing packages.
We provide a bootstrap kit in both source and binary form for other platforms, consisting of the pkg administration tools and other tools required to use pkgsrc and build packages.
Table 2. Binary kits and available packages
Platform | Latest snapshot | Binary kit | Binary packages |
---|---|---|---|
Darwin 5.5/powerpc (Mac OS X 10.1.5) | 20021209 | binary kit | |
Darwin 6.6/powerpc (Mac OS X 10.2.6) | 20030623 | binary kit | |
Darwin 7.6/powerpc (Mac OS X 10.3.6) | 20041219 | binary kit | binary packages |
Darwin 7.8/powerpc (Mac OS X 10.3.8) | 20050320 | binary kit | |
Darwin 8.1/powerpc (Mac OS X 10.4.1) | 20050625 | binary kit | binary packages |
Debian GNU Linux/i386 | 20031023 | binary kit | binary packages |
Fedora Core 2 Linux/i386 | 20050618 | binary kit | |
Fedora Core 4 Linux/i386 | 20060105 | binary kit | |
FreeBSD 3.5/i386 | 20030411 | binary kit | |
FreeBSD 4.7/i386 | 20021211 | binary kit | |
FreeBSD 5.0/i386 | 20030411 | binary kit | |
FreeBSD 5.1/i386 | 20030630 | binary kit | |
FreeBSD 5.2.1/i386 | 20040227 | binary kit | |
FreeBSD 5.3/i386 | 20050119 | binary kit | |
Interix 3.5 | 20051010 | binary kit | binary packages |
IRIX 6.5 n32-bit ABI | 20040911 | binary kit | binary packages |
IRIX 6.5 64-bit ABI | 20040912 | binary kit | binary packages |
OpenBSD 3.2/i386 | 20030420 | binary kit | |
OpenBSD 3.3/i386 | 20030503 | binary kit | |
OpenBSD 3.5/i386 | 20040507 | binary kit | |
Slackware Linux 8.1/i386 | 20030417 | binary kit | |
Slackware Linux 9/i386 | 20031023 | binary kit | |
Solaris 8/sparc | 20050220 | binary kit | |
Solaris 8/i386 | 20050220 | binary kit | |
Solaris 9/sparc | 20041208 | binary kit | binary packages |
Solaris 9/i386 | 20030411 | binary kit |
Simply download the binary kit for your platform, and extract it into
/
e.g.
|
Of course, as with any binary distributions, you should verify the checksum against the SUM or CKSUM file and inspect the contents before extracting it.
You can download the pkgsrc tarball (updated weekly) or checkout the latest sources using AnonCVS:
|
(for setting up AnonCVS, see Tracking NetBSD-current).
After downloading and/or extracting the sources, installing the bootstrap kit should be as simple as:
|
This will use the defaults of /usr/pkg
for the
prefix and /var/db/pkg
for
the package database directory. However, these can also be set using
command-line parameters (use ./bootstrap --help
to see the available options).
Note that when using pkgsrc on a non-NetBSD system, use the bmake command instead of “make” to run the NetBSD make, which is required for correct pkgsrc operation. Simply substitute “bmake” for “make” in pkgsrc documentation.
A selection of precompiled binary packages for NetBSD 1.6.x and 2.0.x is available from /pub/NetBSD/packages on NetBSD FTP sites.
The majority of users will find the browsable web listing most useful.
Packages can be installed either by downloading a package and its prerequisites to a local disk and running:
|
or directly by specifying the full URL as in:
|
Prerequisites will be automatically retrieved and installed if they are available in the same remote directory.
Packages are installed by default into /usr/pkg
.
You should ensure that /usr/pkg/bin
and
/usr/pkg/sbin
are in your PATH variable (best set
in /etc/csh.cshrc
).
The NetBSD Packages Collection consists of a set of Makefiles, brief descriptions, and any patches needed to ensure easy compilation of third-party programs.
Installing pkgsrc will allow you to easily compile and install any of the software contained in the collection.
There are several methods for obtaining pkgsrc, including AnonCVS and FTP. More details can be found in the full pkgsrc documentation.
After obtaining pkgsrc, the /usr/pkgsrc
directory
now contains a set of packages, organized into categories. You can browse
the online index of packages, or run make readme
from the /usr/pkgsrc
directory to build local
README.html files for all packages, viewable with any web browser such as
www/lynx
or
www/mozilla
.
The default prefix for installed packages is
/usr/pkg
. If you wish to change this, you should
do so by setting LOCALBASE
in
/etc/mk.conf
(What is /etc/mk.conf?). You should not try to use multiple
different LOCALBASE
definitions on the same system
(inside a chroot is an exception).
Installing packages is quite easy. For example, to install the editor
called Joe onto your system (editors/joe
is a small but
powerful editor that mimics other editors such as Wordstar or Emacs),
first change directory as follows:
|
If you use a dialup connection to gain access to the internet, connect now, so the software source can be retrieved for you.
If you have all files that you need in
/usr/pkgsrc/distfiles
,
you don't need to connect. If the distfiles are on CD-ROM, you can
mount the CD-ROM on /cdrom
and add:
DISTDIR=/cdrom/pkgsrc/distfiles |
to /etc/mk.conf
.
If a package depends on many other packages (such as
meta-pkgs/kde3
), the build process may
alternate between periods of
downloading source, and compiling. To ensure you have all the source
downloaded initially you can run the command:
|
which will output and run a set of shell commands to fetch the
necessary files into /usr/pkgsrc/distfiles
. You can
also choose to download the files into
/usr/pkgsrc/distfiles
manually.
You can retrieve the files from mirror servers near your network.
just copy the MASTER_SITE_*
definitions for your
country from pkgsrc/mk/defaults/mk.conf
to
/etc/mk.conf
.
Now run
|
from within the /usr/pkgsrc/editors/joe
directory.
The sources and any patches, plus any software that the compilation of
the program requires will now be downloaded to your system.
Once the software has downloaded, any patches will be applied, then it will be compiled for you. This may take some time depending on your computer, and how many other packages the software depends on and their compile time.
The next stage is to actually install the newly compiled program onto your system. Do this by entering:
|
while you are still in the /usr/pkgsrc/editors/joe
directory, (or the directory for whatever it is you are installing).
That's it, the software should now be installed and setup for use. You can enter:
|
to remove the compiled files in the work directory, as you shouldn't need them any more. If other packages were also added to your system (dependencies) to allow your program to compile, you can tidy these up also with the command:
|
/etc/mk.conf
can be used to define certain variables
for the package system. It is not present by default, but can be created
when needed. Among the many values which can be set are:
LOCALBASE=/local
Defines the prefix used by pkgsrc, the default is
/usr/pkg
. This should not be changed on a system
which is already using pkgsrc.
ACCEPTABLE_LICENSES=no-commercial-use fee-based-commercial-use
Inform the package system which licences are acceptable.
WRKOBJDIR=/usr/obj/pkg
Extract and build the packages in /usr/obj/pkg
.
PACKAGES=${_PKGSRCDIR}/packages/${OS_VERSION}/${MACHINE_ARCH}
When binary packages are made, save them in an
OS_VERSION
and MACHINE_ARCH
specific subdirectory.
DEPENDS_TARGET=package
Automatically build and save binary packages on dependencies.
Also,
pkgsrc/mk/defaults/mk.conf
gives the defaults which are used in pkgsrc. This file can be used as a
guide to set values in /etc/mk.conf
- it is only
necessary to set values where they differ from the defaults.
The NetBSD Security-Officer and Packages Groups maintain a list of known security vulnerabilities to packages which are (or have been) included in pkgsrc. The list is available from the NetBSD FTP site at ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/vulnerabilities.
Through security/audit-packages
,
this list can be downloaded
automatically, and a security audit of all packages installed on a system
can take place.
There are two components to
security/audit-packages
. The first
component, “download-vulnerability-list”, is for downloading
the list of vulnerabilities from the NetBSD FTP site. The second
component, “audit-packages”, checks to see if any of your
installed packages are vulnerable. If a package is vulnerable, you
will see output similar to the following:
Package samba-2.0.9 has a local-root-shell vulnerability, see http://www.samba.org/samba/whatsnew/macroexploit.html |
One can set up security/audit-packages
to download the
vulnerabilities
file daily, and include a package audit in the daily security script.
Details on this are located in the MESSAGE
file for security/audit-packages
.
Install pkgtools/pkglint
and run
lintpkgsrc with the “-i”
argument to check if your packages are up-to-date, e.g.
|
You can then use make update to update the package on your system and rebuild any dependencies.
Other useful command to use with the NetBSD Package Collection are shown below.
removes an installed package from your system. The reverse to the procedure performed above. Change to the appropriate pkgsrc directory before use.
removes a pkg by name, regardless of your current working directory.
shows what packages are installed on your system, as any that you add are kept track of.
There are a number of additional tools in pkgsrc that provide additional features for maintaining a pkgsrc system. See the Utilities for package management (pkgtools) section of the pkgsrc guide for a list.