There are many ways to upgrade FreeBSD along with installed packages to the newest version(s), most of them include compilation (buildworld/portmaster), this HOWTO will provide simple and fast way to upgrade FreeBSD system without needless compilation.
Upgrade if the
base system is relatively easy, its about to type 4 commands, read and UNDERSTAND on screen comunicates, if it goes to packages, we will use the fact, that all packages are build to newest version along with newest *-RELEASE version.
0. CONFIGURATION BACKUP (rather not needed, but ...)
root # tar -czf /root/ETC.tar.gz /etc /usr/local/etc
1. BASE SYSTEM UPGRADE (I assume that 8.1-RELEASE is the current latest version)
root # freebsd-update upgrade -r 8.1-RELEASE
root # freebsd-update install
root # shutdown -r now
root # freebsd-update install
While doing the
base system procedure we will be asked for installed 'datasets' and about modifications in config files, we only need to read and UNDERSTAND the on screen comunicats.
2. PACKAGES UPGRADE
root # pkg_info -qoa > /root/packagelist
root # pkg_delete -a -f
root # rm -r -f /boot/modules /usr/local /var/db/pkg
root # while read PKG; do pkg_add -r $( basename ${PKG} ); done < /root/packagelist
At this point all old packages have been removed, and latest pacakges have been installed on their place, it works automatically, unless port nam has changed, like with
VirtualBox, when its port name changed from
emulators/virtualbox into
emulators/virtualbox-ose, so the only 'risk' here, is that some packages will not be added automatically.
2.1. SEARCHING FOR MISSED PACKAGES
root # pkg_info -qoa > /root/packagelist.NEW
root # diff -u /root/packagelist*
This way is probable the fastest and easiest to find missed packages.
3. CLEANUP
root # rm -r -f /root/packagelist*
root # rm -r -f /root/ETC.tar.gz
If we had made some bigger changes in the configuration, we may keep the old configuration (
/root/ETC.tar.gz).