pkgsrc survival guide

Installing and updating pkgsrc

Configure CVS

Put the following lines in ~/.cvs.rc:

    checkout -P
    update -dP
    release -d
    diff -upN
    cvs -q -z3
    rdiff -u

Fetch pkgsrc (stable branch)

    $ cd /usr
    $ cvs checkout -r pkgsrc-20xxQy -P pkgsrc

Skip the -r option to fetch the current branch.

Update pkgsrc

    $ cd /usr/pkgsrc
    $ cvs update -dP [-r pkgsrc-xxxxQx]

Manage binary packages

Configuration

Configure the following environment variables:

    PATH="/usr/pkg/sbin:$PATH"
    PKG_PATH="ftp://ftp.NetBSD.org/pub/pkgsrc/packages/OPSYS/ARCH/VERSION/All"
    export PATH PKG_PATH

Basic tasks

Install a package:

    $ pkg_add <package>

Remove a package:

    $ pkg_delete [-r] <package>

-r option removes all packages that require the package in question and the package itself.

Getting information about installed packages:

    $ pkg_info

Check for package updates:

    $ lintpkgsrc -i

Check for security vulnerabilities

Download the list of vulnerabilities:

    $ pkg_admin fetch-pkg-vulnerabilities

Audit installed packages:

    $ pkg_admin audit

Building packages from source

To fetch all the sources (all packages the choosen package depends on) before compiling the choosen package:

    $ cd /package/directory
    $ make fetch-list | sh

To build:

    $ make

To install:

    $ make install

To clean working files:

    $ make clean

To clean working files of the package and all it's dependencies:

    $ make clean-depends

To install the binary version of a package:

    $ make bin-install

To create a binary package after installing it:

    $ make package

To update a yet installed package:

    $ make update