Getting the best out of pkgsrc (by )

With pkgsrc, it's easy to install a package. You just go into the appropriate directory under /usr/pkgsrc and type make install. However, it's easier to maintain in the long run if you use pkg_chk to do this for you, since it can also handle upgrades reliably and automatically, and ensure that no packages are missing.

To start with, install pkgtools/pkg_chk:

cd /usr/pkgsrc/pkgtools/pkg_chk
make install

pkg_chk works by keeping a list of the packages you want installed in a file, /usr/pkgsrc/pkgchk.conf. You edit this file, then you can run pkg_chk -a to install any packages that are listed in the file but not installed, or pkg_chk -u to update any packages listed in the file for which more recent versions are in pkgsrc than you have installed. However, it's more efficient to type pkg_chk -r to remove any packages which new versions of exist then pkg_chk -a to add the new versions back in - pkg_chk -u can end up rebuilding the same package more than once.

So a good basic starting pkgchk.conf file would be:

devel/cpuflags
security/audit-packages
pkgtools/pkg_chk

That's all you have installed so far. Add the names of other packages you want. You can put comments in the file (start a line with #), leave blank lines, etc. See the pkg_chk man page for more details, including the 'tags' feature that can let you share one master pkgchk.conf file between several servers easily.

From time to time (especially when audit-packages complains you have vulnerable packages installed!) you can update all of your packages with the following commands:

cd /usr/pkgsrc
cvs update
cd pkgtools/pkg_chk
make update
pkg_chk -r
pkg_chk -a

The explicit make update of pkg_chk is there since if there's a new version of pkg_chk, it'll gladly uninstalled itself when you run it with -r...

Pages: 1 2 3

4 Comments

  • By Ben, Mon 5th Mar 2007 @ 8:26 am

    OpenBSD discourages use of processor specific optimisations as reveals bugs in the compiler which produce incorrect code. Does this not apply here?

  • By alaric, Mon 5th Mar 2007 @ 10:51 am

    Revealing the bugs would be a good first step to fixing them 😉

  • By Ben, Mon 5th Mar 2007 @ 10:57 am

    You are very kind to offer your production server as a test bed for the community's benefit.

  • By Matt, Wed 7th Mar 2007 @ 8:19 pm

    Kind, of Craaaaaaaaaaaaazy!

Other Links to this Post

RSS feed for comments on this post.

Leave a comment

WordPress Themes

Creative Commons Attribution-NonCommercial-ShareAlike 2.0 UK: England & Wales
Creative Commons Attribution-NonCommercial-ShareAlike 2.0 UK: England & Wales