FreeBSD Handbook
Prev | Chapter 5 Installing Applications: Packages and Ports | Next

# 5.2 Overview of Software Installation

The typical steps for installing third-party software on a UNIX® system include:

1. Download the software, which might be distributed in source code format, or as a binary.

2. Unpack the software from its distribution format (typically a tarball compressed with compress(1), gzip(1), or bzip2(1)).

3. Locate the documentation in `INSTALL`, `README` or some file in a `doc/` subdirectory and read up on how to install the software.

4. If the software was distributed in source format, compile it. This may involve editing a `Makefile`, or running a `configure` script, and other work.

5. Test and install the software.

If you are installing a software package that was not deliberately ported to FreeBSD you may even have to go in and edit the code to make it work properly.

FreeBSD provides two technologies which perform these steps for you. At the time of writing, over 24,000 third-party applications are available.

A FreeBSD package contains pre-compiled copies of all the commands for an application, as well as any configuration files and documentation. A package can be manipulated with FreeBSD package management commands, such as pkg_add(1), pkg_delete(1), and pkg_info(1).

A FreeBSD port is a collection of files designed to automate the process of compiling an application from source code. The files that comprise a port contain all the necessary information to automatically download, extract, patch, compile, and install the application.

The ports system can also be used to generate packages which can be manipulated with the FreeBSD package management commands.

Both packages and ports understand dependencies. If pkg_add(1) or the Ports Collection is used to install an application and a dependent library is not already installed, the library will automatically be installed first.

While the two technologies are quite similar, packages and ports each have their own strengths. Select the technology that meets your requirements for installing a particular application.

Package Benefits

- A compressed package tarball is typically smaller than the compressed tarball containing the source code for the application.

- Packages do not require compilation time. For large applications, such as Mozilla, KDE, or GNOME this can be important, on a slow system.

- Packages do not require any understanding of the process involved in compiling software on FreeBSD.

Ports Benefits

- Packages are normally compiled with conservative options because they have to run on the maximum number of systems. By compiling from the port, one can change the compilation options.

- Some applications have compile-time options relating to which features are installed. For example, Apache can be configured with a wide variety of different built-in options.

  In some cases, multiple packages will exist for the same application to specify certain settings. For example, Ghostscript is available as a `ghostscript` package and a `ghostscript-nox11` package, depending on whether or not Xorg is installed. Creating multiple packages rapidly becomes impossible if an application has more than one or two different compile-time options.

- The licensing conditions of some software forbid binary distribution. These must be distributed as source code which must be compiled by the end-user.

- Some people do not trust binary distributions or prefer to read through source code in order to look for potential problems.

- If you have local patches, you will need the source in order to apply them.

To keep track of updated ports, subscribe to the FreeBSD ports mailing list and the FreeBSD ports bugs mailing list.

> Warning: Before installing any application, check http://vuxml.freebsd.org/ for security issues related to the application or install `ports-mgmt/portaudit`. Once installed, type `portaudit -F -a` to check all installed applications for known vulnerabilities.

The remainder of this chapter explains how to use packages and ports to install and manage third-party software on FreeBSD.

Prev | Home | Next
Installing Applications: Packages and Ports | Up | Finding Software