Table of Contents
The files that are installed by pkgsrc are organized in a way that
is similar to what you find in the /usr directory
of the base system. But some details are different. This is because
pkgsrc initially came from FreeBSD and had adopted its file system
hierarchy. Later it was largely influenced by NetBSD. But no matter
which operating system you are using pkgsrc with, you can expect the
same layout for pkgsrc.
There are mainly four root directories for pkgsrc, which are all
configurable in the bootstrap/bootstrap script.
When pkgsrc has been installed as root, the default locations
are:
LOCALBASE= /usr/pkg PKG_SYSCONFBASE= /usr/pkg/etc VARBASE= /var PKG_DBDIR= /usr/pkg/pkgdb
In unprivileged mode (when pkgsrc has been installed as any other user), the default locations are:
LOCALBASE= ${HOME}/pkg
PKG_SYSCONFBASE= ${HOME}/pkg/etc
VARBASE= ${HOME}/pkg/var
PKG_DBDIR= ${HOME}/pkg/pkgdb
What these four directories are for, and what they look like is explained below.
LOCALBASE corresponds to the
/usr directory in the base system. It is the
“main” directory where the files are installed and contains
the well-known subdirectories like bin,
include, lib,
share and
sbin.
VARBASE corresponds to
/var in the base system. Some programs (especially
games, network daemons) need write access to it during normal
operation.
PKG_SYSCONFDIR corresponds to
/etc in the base system. It contains configuration
files of the packages, as well as pkgsrc's mk.conf
itself.
The following directories exist in a typical pkgsrc installation
in ${LOCALBASE}.
binContains executable programs that are intended to be directly used by the end user.
emulContains files for the emulation layers of various other operating systems, especially for NetBSD.
etc (the usual location of
${PKG_SYSCONFDIR})Contains the configuration files.
includeContains headers for the C and C++ programming languages.
infoContains GNU info files of various packages.
libContains shared and static libraries.
libdataContains data files that don't change after
installation. Other data files belong into
${VARBASE}.
libexecContains programs that are not intended to be used by end users, such as helper programs or network daemons.
libexec/cgi-binContains programs that are intended to be executed as CGI scripts by a web server.
man (the usual value of
${PKGMANDIR})Contains brief documentation in form of manual pages.
sbinContains programs that are intended to be used only by the super-user.
shareContains platform-independent data files that don't change after installation.
share/docContains documentation files provided by the packages.
share/examplesContains example files provided by the packages. Among
others, the original configuration files are saved here and copied to
${PKG_SYSCONFDIR} during
installation.
share/examples/rc.dContains the original files for rc.d scripts.
var (the usual location of
${VARBASE})Contains files that may be modified after installation.