Configuration for Unprivileged Pkgsrc Work

1  Overview

In order to work with the NetBSD pkgsrc system as an unprivileged user, you must make a few changes to your setup. The steps are the following. Each is detailed below. More information about the pkgsrc system in general is available online at http://www.netbsd.org/Documentation/software/packages.html.
  1. Create a file that defines the appropriate set of variables for make(1).

  2. Configure the shells to define the appropriate environment variables when they run.

  3. Install the system packaging tools within your home directory.

  4. Download a copy of pkgsrc to work with.

  5. Install a few prerequisite packages.

2  mk.conf file

Install the following file in $HOME/etc/pkgsrc.mk.conf: pkgsrc.mk.conf. This location is chosen simply to parallel the standard (see hier(7)) location of /etc/mk.conf.

3  Shell configuration

You must configure both the C and Bourne shells.

3.1  C shell configuration

Edit the .cshrc file in your home directory to accomplish the following:
  1. Modify the path environment variable to include ~/pkg/bin and ~/pkg/sbin early in your path. These must precede /usr/pkg/bin and /usr/pkg/sbin if they are present.
  2. Add the following lines:
    # cvs
    setenv CVS_RSH ssh
    
    # pkgsrc
    setenv  MAKECONF ${HOME}/etc/pkgsrc.mk.conf
    
    # xpkgwedge
    setenv XAPPLRESDIR ${HOME}/pkg/lib/X11/app-defaults
    

3.2  Bourne shell configuration

Edit the .profile file in your home directory to accomplish the following:
  1. Modify the PATH environment variable to include $HOME/pkg/bin and $HOME/pkg/sbin early in your path. These must precede /usr/pkg/bin and /usr/pkg/sbin if they are present.
  2. Add the following lines:
    # cvs
    CVS_RSH=ssh
    export CVS_RSH
    
    # pkgsrc
    MAKECONF=$HOME/etc/pkgsrc.mk.conf
    export MAKECONF
    
    # xpkgwedge
    XAPPLRESDIR=$HOME/pkg/lib/X11/app-defaults
    export XAPPLRESDIR
    

4  Installing system packaging tools

In order to begin the process of using packages from within your home directory you must copy the system packaging tools from their standard location, which is /usr/sbin to within your home directory in $HOME/pkg/sbin. It is sufficient to do the following:
mkdir -p $HOME/pkg/sbin
cp /usr/sbin/pkg_* $HOME/pkg/sbin

5  Obtain pkgsrc

You should install the pkgsrc files in the directory $HOME/pkgsrc. For instructions on how to do this via CVS, see me. To start though, you need to set yourself up to use ssh(1). Do this by running the following commands:
ssh-keygen -t dsa
ssh-keygen -t rsa
ssh-keygen -t rsa1
Accept at least the default location of the files, and email me copies of the *.pub files in $HOME/.ssh. Note that when you email copies of the files you must be certain that you send them in their original form; that is, do not break their contents into multiple lines or otherwise modify the files.

6  Install prerequisite packages

Several prerequisite packages need to be installed before you begin work. These are the following:
pkgtools/digest
pkgtools/pkg_diff
pkgtools/pkg_install
pkgtools/pkglint
pkgtools/url2pkg
pkgtools/xpkgwedge

To install these packages, cd(1) into the appropriate directory and type make. If the build was successful, type make install. Finally, type make clean to remove the files used during the build.


This document was translated from LATEX by HEVEA.