Directory layout of the installed files
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= /var/db/pkg
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/var/db/pkg
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.
File system layout in ${LOCALBASE}
The following directories exist in a typical pkgsrc installation
in ${LOCALBASE}.
bin
Contains executable programs that are intended to be
directly used by the end user.
emul
Contains files for the emulation layers of various other
operating systems, especially for
NetBSD.
etc (the usual location of
${PKG_SYSCONFDIR})Contains
the configuration files.
include
Contains headers for the C and C++ programming
languages.
info
Contains GNU info files of various
packages.
lib
Contains shared and static
libraries.
libdata
Contains data files that don't change after
installation. Other data files belong into
${VARBASE}.
libexec
Contains programs that are not intended to be used by
end users, such as helper programs or network
daemons.
libexec/cgi-bin
Contains 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.
sbin
Contains programs that are intended to be used only by
the super-user.
share
Contains platform-independent data files that don't
change after installation.
share/doc
Contains documentation files provided by the
packages.
share/examples
Contains 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.d
Contains the original files for rc.d
scripts.
var (the usual location of
${VARBASE}) Contains files
that may be modified after
installation.
File system layout in ${VARBASE}
db/pkg (the usual location of
${PKG_DBDIR})Contains
information about the currently installed
packages.
games
Contains highscore
files.
log
Contains log files.
run
Contains informational files about daemons that are
currently running.