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=ftp://ftp.NetBSD.org/pub/NetBSD/packages/1.6.1/i386/All

For OpenBSD, add this to .cshrc:

setenv PKG_PATH ftp://ftp.openbsd.org/pub/OpenBSD/3.4/packages/i386/

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 pkgsrc.netbsd.se 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:

parsing: ftp://ftp.NetBSD.org/pub/NetBSD/packages/1.6.1/i386/All
path: ftp://ftp.NetBSD.org/pub/NetBSD/packages/1.6.1/i386/All
increasing RLIMIT_NOFILE to max. 1772 open files
trying PKG_PATH ftp://ftp.NetBSD.org/pub/NetBSD/packages/1.6.1/i386/All
Spawning FTP coprocess
ftp -detv ftp://ftp.NetBSD.org/pub/NetBSD/packages/1.6.1/i386/All/

Eventually it finds what it needs:

nlist mtr-gtk-*.t[bg]z /var/tmp/pkg.02535d
ftp> cd .
best match: 'ftp://ftp.NetBSD.org/pub/NetBSD/packages/1.6.1/i386/All/mtr-gtk-0.52.tgz'
'ftp://ftp.NetBSD.org/pub/NetBSD/packages/1.6.1/i386/All/mtr-gtk-[0-9]*.t[bg]z'
expanded to 'ftp://ftp.NetBSD.org/pub/NetBSD/packages/1.6.1/i386/All/mtr-gtk-0.5
2.tgz'
Trying to fetch ftp://ftp.NetBSD.org/pub/NetBSD/packages/1.6.1/i386/All/mtr-gtk-
0.52.tgz.
...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-2.05.2.7nb1 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 ports.puffy.nu. 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://ftp.openbsd.org/pub/OpenBSD/3.4/packages/i386//mtr-0.49.tg
z.
>>> ftp -o - ftp://ftp.openbsd.org/pub/OpenBSD/3.4/packages/i386//mtr-0.49.tgz
Extracting from FTP connection into /var/tmp/instmp.Zouhf13798
Unknown command.
+CONTENTS
+COMMENT
+DESC
sbin/mtr
man/man8/mtr.8
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.

Comments

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

Popular posts from this blog

Zeek in Action Videos

MITRE ATT&CK Tactics Are Not Tactics

New Book! The Best of TaoSecurity Blog, Volume 4