Table of Contents

FreeBSD Cheat Sheet

Binary package management basics with pkgng

See: http://www.freebsd.org/doc/handbook/pkgng-intro.html

IMPORTANT: As of this writing (March 2013) the pkgng repositories are offline, see https://wiki.freebsd.org/pkgng#Availability_of_pkgs_for_Download

Boostrap

BIG WARNING: After converting to the new format, the pkg_install tools should NOT be used any more. See the link provided above for more details.

FreeBSD 9.1:

# pkg
# pkg2ng
# echo 'WITH_PKGNG=	yes' >> /etc/make.conf

FreeBSD below 9.1:

# pkg_add -r pkg
# pkg2ng
# echo 'WITH_PKGNG=	yes' >> /etc/make.conf

Install package from the Internet

# pkg install $somepackage

Binary package management basics (traditional)

Install package from the Internet

# pkg_add -r $somepackage

Package names are case sensitive

Alternatively, locate the package in FreeBSD's servers and download and install manually:

# wget ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-$FREEBSD_VERSION/Latest/$PACKAGENAME.tbz
# pkg_add $PACKAGENAME.tbz

List installed packages

# pkg_info

Uninstall package

# pkg_delete $PACKAGE-$VERSION

The package version IS required to uninstall, it can be obtained with pkg_info

Upgrade binary packages

All packages:

# portupgrade -PP -a

Single package:

# portupgrade -PP $somepackage

The -PP forces a binary package download instead of building the port. Requires an updated ports tree, see below.

Update ports tree

# portsnap fetch
# portsnap update

Upgrade to a new release

# freebsd-update -r $RELEASE_VERSION upgrade
# freebsd-update install
# reboot
# freebsd-update install 

Replace $RELEASE_VERSION with the actual version, e.g. 9.1 or 8.3-RELEASE. freebsd-update install must be run twice, once before and once after rebooting.

References