[talk] NetBSD beginner's question: Why is it so difficult to install packages?
James E Keenan
jkeenan at pobox.com
Fri Aug 23 18:50:21 EDT 2019
Today is my first day working on NetBSD. Installing packages on NetBSD
seems to be more complex than on FreeBSD or OpenBSD. I suspect I'm
missing something very basic (but not something obvious, obviously).
I. Background
I install various OSes as VirtualBox VMs, managed by Vagrant, on a
FreeBSD-11 host. With varying degrees of difficulty I have installed
FreeBSD 11, 12 and 13 VMs and OpenBSD 6.3 and 6.4 hosts. Today, with
considerable difficulty, I installed a NetBSD-8.0 VM on this host.
One of the first challenges I face when working in a VM for a new OS is
how to install packages. In the FreeBSD-11 or -12 VMs, this is very
simple. As user 'vagrant', I say:
#####
sudo pkg install cmdwatch
#####
... and 'pkg' goes to the mirror (which happens to be maintained by
NYCBUG), gets the latest version of 'cmdwatch', downloads and installs
it. Note that with this syntax I don't have to know either the URL to
the mirror, the version number for the package, whether it's packaged as
a '.tar.gz', a '.tgz' or whatever.
Remember that I said I manage these VMs via Vagrant? Ensuring that I am
always upgrading to the latest stable version of a package is easy. I
simply add a line to the SHELL script which is defined within the
Vagrantfile and which runs with 'vagrant up' or 'vagrant reload
--provision':
#####
sudo pkg install -y cmdwatch
#####
... where the '-y' means "upgrade if available." The Vagrantfile does
not need to know the URL to the mirror, the package version number, or
its compression. It just DWIMs.
II. The Current Problem
As far as I can tell from reading http://www.netbsd.org/docs/pkgsrc/ --
there sadly being no Michael W Lucas books on NetBSD available -- it
appears I have to tell the machine the URL for the mirror and specify
the exact version number for the package on that mirror. For example, I
had to call:
#####
PKG_PATH="http://cdn.NetBSD.org/pub/pkgsrc/packages/$(uname -s)/$(uname
-m)/$(uname -r|cut -f '1 2' -d.)/All/"
#####
... which translated into:
#####
export
PKG_PATH=http://cdn.NetBSD.org/pub/pkgsrc/packages/NetBSD/amd64/8.0/All/
#####
... and then call:
#####
sudo pkg_add -v "$PKG_PATH/perl-5.28.2.tgz"
#####
or
#####
sudo pkg_add -v "$PKG_PATH/watch-3.2.6nb4.tgz"
#####
All of which means that I have to manually search cdn.NetBSD.org to get
the full URL. And there's no way I can put a filename like
'watch-3.2.6nb4.tgz' into a Vagrantfile and expect it to be maintainable.
What am I missing? What is the NetBSD equivalent to FreeBSD's 'sudo pkg
install -y perl5 vim git subversion screen wget cmdwatch'?
Thank you very much.
Jim Keenan
More information about the talk
mailing list