I have been meaning to write this little snippet about portsnap for some time. I think it was around the first of the year when my CVSup cron quit working and after digging into it a bit, noticed some major problems in the CVSup snapshot. In search of a different method to update and upgrade the FreeBSD ports tree, I found the portsnap utility.
CVSup has some inherent problems, and if you have ever experienced the pkgdb -F error while running portupgrade (post CVSup), then you know the tangled nightmare that sometime ensues, just to get the ports tree back to a consistent build. Not to mention that CVSup is insecure and slow!
Since I am not using the latest and greatest FreeBSD on my production server, I needed to install portsnap. A quick cd to /usr/ports/sysutils/portsnap and a make install clean whipped the portsnap package onto my system in no time. I copied the portsnap.conf.sample from /usr/local/etc/ to /etc/and edited the file accordingly (needed to make adjustments to the default download location).
A simple ‘portsnap fetch’ downloaded a new ports tree snapshot in minutes, compared to hours with CVSup! Next up was to run a ‘portsnap extract’ followed by a ‘portsnap update’. In no time at all, my entire ports tree was updated. To finish the upgrade process of all my packages that were installed from ports, I ran a ‘portupgrade -arR’.
Another utility that I depend on greatly is the portaudit utility which basically tells me when I have a package that has a security vulnerability or needs other attention. The combination of using portaudit to keep me informed of needed packages, portsnap to update my ports, and portugrade to update installed packages, my FreeBSD box stays running very smoothly. If you are still using CVSup to get your port snapshots, I highly recommend using portsnap instead.