An Introduction to FreeBSD Ports Collection

For most of my posts that cover the installation of software on dedicated servers, I have focused on Linux package managers like YUM and APT. Many servers, however, run variations of BSD (FreeBSD, NetBSD, OpenBSD, etc.). Therefore, it would be shortsighted to ignore Ports Collection, which is FreeBSD’s answer to software installation.

Unlike most Linux package managers, which unpack archives and copy pre-compiled binaries to the system, Ports compiles the software from source, based on pre-defined makefiles. In most cases, the software compilation does not require any user intervention, which is different from actually building software oneself. Ports automatically downloads the source from the Internet, configures according to its specifications, compiles it, installs it, and then makes record of the installation in the package database. This makes uninstalling rather painless as well.

In addition to building packages from source, many Ports packages also have pre-built binaries available as an option. The advantage of building from source is a more stable application tailored to a user’s specific hardware. The disadvantage is the amount of time it takes to build, particularly for large applications. In a server environment, time may not be a critical issue with installing software, so building from source may be acceptable, as long as it does not tie up the CPU.

Currently the Ports Collection includes over 22,100 ports. The packaging system has been adopted by other operating systems, such as NetBSD, which adapted it for its pkgsrc system, and Gentoo Linux, which uses a similar system called Portage. There is also a Ports version for Mac OS X called MacPorts.