4.4 Using the Binary Packages System

Original FreeBSD documentation contributed by DragonFly BSD customizations contributed by Chern Lee and Adrian Nida.

4.4.1 Installing a Binary Package

You can use the pkg_add(1) utility to install a pkgsrc® software package from a local file or from a server on the network.

Example 4-1. Downloading a Package Manually and Installing It Locally

# ftp -a packages.stura.uni-rostock.de
Connected to fsr.uni-rostock.de.
220 packages.stura.uni-rostock.de FTP server (Version 6.00LS) ready.
331 Guest login ok, send your email address as password.
230 Guest login ok, access restrictions apply.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> cd /pkgsrc-current/DragonFly/RELEASE/i386/All/
250 CWD command successful.
ftp> get 0verkill-0.15.tgz
local: 0verkill-0.15.tgz remote: 0verkill-0.15.tgz
229 Entering Extended Passive Mode (|||61652|)
150 Opening BINARY mode data connection for '0verkill-0.15.tgz' (174638 bytes).
100% |*************************************|   170 KB  159.37 KB/s    00:00 ETA
226 Transfer complete.
174638 bytes received in 00:01 (159.30 KB/s)
ftp> exit
221 Goodbye.
# pkg_add 0verkill-0.15.tgz

Note: It should be noted that simply issuing:

# pkg_add ftp://packages.stura.uni-rostock.de/pkgsrc-current/DragonFly/RELEASE/i386/All/0verkill-0.15.tgz
will yield the same result as the above example.

Unlike the FreeBSD version, the Pkgsrc pkg_add(1) does not need to be passed the -r option. As can be seen from the second example, you just need to pass in the URL of the package. The utility will also always automatically fetch and install all dependencies.

The example above would download the correct package and add it without any further user intervention. If you want to specify an alternative DragonFly Packages Mirror, instead of the main distribution site, you have to set PACKAGESITE accordingly, to override the default settings. pkg_add(1) uses fetch(3) to download the files, which honors various environment variables, including FTP_PASSIVE_MODE, FTP_PROXY, and FTP_PASSWORD. You may need to set one or more of these if you are behind a firewall, or need to use an FTP/HTTP proxy. See fetch(3) for the complete list.

Binary package files are distributed in .tgz formats. You can find them at the default location ftp://goBSD.com//packages/, among other sites. The layout of the packages is similar to that of the /usr/pkgsrc tree. Each category has its own directory, and every package can be found within the All directory.

The directory structure of the binary package system matches the source tree layout; they work with each other to form the entire package system.

4.4.2 Managing Packages

pkg_info(1) is a utility that lists and describes the various packages installed.

# pkg_info
digest-20050731     Message digest wrapper utility
screen-4.0.2nb4     Multi-screen window manager
...

pkg_version(1) is a utility that summarizes the versions of all installed packages. It compares the package version to the current version found in the ports tree.

4.4.3 Deleting a Package

To remove a previously installed software package, use the pkg_delete(1) utility.

# pkg_delete xchat-1.7.1

4.4.4 Miscellaneous

All package information is stored within the /var/db/pkg directory. The installed file list and descriptions of each package can be found within subdirectories of this directory.

Contact the Documentation mailing list for comments, suggestions and questions about this document.