Table of Contents
FreeBSD releases
Current releases are 8.2 and 7.4. See the release pages.
FreeBSD system
A FreeBSD system is composed of:
- The base system, consisting of the kernel plus world (the userland OS files in /usr/src), updated with csup.
- User installed applications, which are handled via the ports tree, see /var/db/pkg/*, updated by compiling ports or installing binary packages.
FreeBSD update
installing from source - ports
1. Run portsnap to sync the ports tree
portsnap fetch portsnap extract (only first time) portsnap update
2. Run portsdb to update INDEX.db.
- check for vulnerabilities:
portaudit -Fda
- update INDEX.db (use -Uu to create de DB and -fu to recreate it if corrupted)
portsdb -Fu
3. Use portversion to determine which applications need upgrading.
portversion -l "< "
4. Use portupgrade to upgrade those applications:
- upgrade all with dependencies using interactive mode:
portupgrade -arRi
- with logfile
portupgrade -rR ruby-shim-ruby18 -l logfile
installing binary packages
These precompiled packages are separated into categories by the architectures for which they are available. Packages are further separated into several “release” directories, one for each current production release built from the ports collection and shipped with the release. These production release directories are never updated. There are also stable and current directories for several major release branches. These are updated more or less weekly. In most cases a package created for an older version of FreeBSD can be installed and used on a newer system without difficulty since binary backward compatibility across major releases is enabled by default.
pkg_add -r <paket> pkg_deinstall paket* or pkg_delete paket
- Unordered List Itemlist of installed packages
pkg_info
- list outdated ports
pkg_version -v
- list unused ports
pkg_cutleaves
- find out to which port an application belongs
pkg_which pkgdb pkg_which -v kde*
freebsd-update
freebsd-update provides binary upgrades to the FreeBSD base system. It only works on RELEASE systems with a GENERIC kernel, and provides two separate functions:
1. it allows for binary security and errata updates to be applied to the FreeBSD base system without the build and install requirements.
freebsd-update fetch freebsd-update install
2. the utility supports minor and major release upgrades.
freebsd-update -r 8.2-RELEASE upgrade
See this for details of upgrading to 8.2-RELEASE.
upgrading packages
There's only one ports tree. The ports tree doesn't branch. There is no special version of the ports tree to go with a specific version of FreeBSD. However, there are pre-built packages for -stable and -release. pkg_add -r is the binary method, but if the latest version is no available in the default RELEASE mirror, the variable PACKAGESITE should be changed to STABLE as packages-*-release directories are built from the ports collection shipped with the release, and are not updated. But packages-*-stable and packages-*-current are updated roughly once a week. To make this the default, change /usr/local/etc/pkgtools.conf:
setenv PACKAGESITE ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-8-stable/Latest/
- upgrade port tree using portsnap:
portsnap fetch portsnap update
- then update ports db and check if the installed packages and ports are older than the new port tree:
portsdb -Fu portversion -v -l"<"
- if there is anything to upgrade you should make sure that PACKAGESITE is using STABLE instead of RELEASE and then run portupgrade:
portupgrade -vaRrPc
To avoid breaking software you should always check /usr/ports/UPDATING. PKG_SITES will only be used by the ports-mgmt/portupgrade scripts; if you want to use pkg_add(1) manually, and obtain the 8-stable packages, then you should define PACKAGESITE in your environment, or provide a full URL. The ports-mgmt/portupgrade scripts also respect PACKAGESITE, which will override PACKAGEROOT and PKG_SITES in those scripts.
Avoiding ports
If you have a machine with low resources like e.g. running in a VM, or do not want to wait for port compilations, it makes sense to install only pre-built packages while keeping a release base system so that freebsd-update can be used without bothering about compiling your kernel. This is what I chose to do:
- Base system with 8.2-RELEASE, kept up-to-date with freebsd-update fetch and freebsd-update install
- Keep your ports tree updated as shown above
- Set .profile environment variable PACKAGESITE for 8-STABLE to ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-8-stable/Latest/
- Install packages using portupgrade -vaRrPP so that portupgrade tries to find the package version given by the updated ports tree and stops when the package is not available