Installing Packages on NetBSD and OpenBSD

Last month I wrote about installing packages on FreeBSD. This entry covers my NetBSD and OpenBSD experiences.

First, a few differences between NetBSD and OpenBSD. Root's default shell in NetBSD is /bin/sh, while OpenBSD uses /bin/csh. This means environment variables can be set in .profile for NetBSD and .cshrc for OpenBSD.

FreeBSD gives users the chance to automatically retrieve packages and dependencies remotely, e.g., 'pkg_add -r mtr'. FreeBSD makes its remote retrieval decisions based on the installed OS. NetBSD and OpenBSD allow the same, but you must specify the OS in an environment variable.

For NetBSD, add the following to .profile:

export PKG_PATH=

For OpenBSD, add this to .cshrc:

setenv PKG_PATH

These additions make automatic package retrieval easier. I'll install the GTK version of MTR to demonstrate the process on each OS.

For NetBSD, you can browse or search to find packages. A visit there shows two versions of MTR: mtr and mtr-gtk (both with version 0.54nb1).

Install the newest package with this syntax:

pkg_add -v mtr-gtk

Watch pkg_add find the newest package and install it:

increasing RLIMIT_NOFILE to max. 1772 open files
trying PKG_PATH
Spawning FTP coprocess
ftp -detv

Eventually it finds what it needs:

nlist mtr-gtk-*.t[bg]z /var/tmp/pkg.02535d
ftp> cd .
best match: ''
expanded to '
Trying to fetch
...and so on...

When done, MTR version 0.52 and dependencies are installed:
# pkg_info

pkg_info: disabling PKG_PATH when operating on all packages.
pth-1.4.1nb7 GNU Portable Thread library
bash- The GNU Bourne Again Shell
glib-1.2.10nb3 Some useful routines for C programming
gtk+-1.2.10nb3 Gimp toolkit. Libraries for building X11 user interfaces
mtr-gtk-0.52 Traceroute and ping in a single graphical network diagnostic

For OpenBSD, you can browse or search A search for MTR finds "mtr 0.49" and "mtr 0.49-no_x11". To know the exact name, I prefer searching for mtr at BSDcoders. It shows "mtr-0.49
" and "mtr-0.49-no_x11". (One could assume the hyphens were needed earlier, but it's good to be sure.)

To install the package, you must specify the version, unlike FreeBSD or NetBSD:

pkg_add -v mtr-0.49
Trying to fetch
>>> ftp -o -
Extracting from FTP connection into /var/tmp/instmp.Zouhf13798
Unknown command.
tar command returns 0 status
pkg: Handling dependencies for mtr-0.49
checking gtk+-* (gtk+-1.2.10p1) -> Not found
checking gtk.1.2 not found
pkg: Handling dependencies for gtk+-1.2.10p1
checking glib-* (glib-1.2.10) -> Not found
checking glib.1.2 not found
checking libiconv-* (libiconv-1.8) -> Not found
checking iconv.3.0 not found
checking gettext->=0.10.38 (gettext-0.10.40p1) -> Not found
checking intl.1.1 not found
...and so on...

When done, mtr-0.49 and its dependencies are installed:

lemelin# pkg_info
bash-2.05b-static GNU Bourne Again Shell
libiconv-1.8 character set conversion library
gettext-0.10.40p1 GNU gettext
glib-1.2.10 useful routines for C programming
gtk+-1.2.10p1 General Toolkit for X11 GUI
mtr-0.49 Matt's traceroute - network diagnostic tool

The best bet for installing newer versions of any software on BSD is to use the ports tree. The absolute newest version can sometimes be only found in source code from the developer, before the ports tree is modified. Still, to quickly install an app, the package system can't be beat -- especially for large apps with numerous dependencies.


Anonymous said…
This comment has been removed by a blog administrator.

Popular posts from this blog

Five Reasons I Want China Running Its Own Software

Cybersecurity Domains Mind Map

A Brief History of the Internet in Northern Virginia