Chapter 9. Directory layout of the installed files

Table of Contents

9.1. File system layout in ${LOCALBASE}
9.2. File system layout in ${VARBASE}

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.

9.1. 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.

9.2. 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.