The simplest way to install and manage applications and system tools on FreeBSD is through the pkg
package management tool, which makes dealing with binary packages fast and easy. Binary packages are pre-compiled and require no in-depth understanding of compiling software on FreeBSD, making them the ideal method to install software for new users.
1. Getting Started with pkg
FreeBSD includes a bootstrap utility which can be used to download and install pkg and its manual pages. This process will require a working Internet connection.
# /usr/sbin/pkg
pkg
without additional arguments. To access the manual page run:# man pkg
Each pkg command argument is documented in a command-specific manual page. To read the manual page for pkg install
, for example, run either of these commands:
# pkg help install
# man pkg-install
2. Installing and Removing Packages
To install a binary package, use the following command, where packagename is the name of the package to install:
# pkg install packagename
Before the installer proceeds, the system will ask to confirm and approve the changes, this can be done be either typing “y” or “n” to approve or cancel the process. Once complete, the new package and any additional packages that were installed as dependencies can be seen in the installed packages list:
# pkg info
ca_root_nss-3.15.1_1 The root certificate bundle from the Mozilla Project
curl-7.31.0_1 Non-interactive tool to get files from FTP, GOPHER, HTTP(S) servers
pkg-1.1.4_6 New generation package manager
pkg delete
. For example:# pkg delete curl
3. Upgrading Installed Packages
Installed packages can be upgraded to their latest versions by running:
# pkg upgrade
This command will compare the installed versions with those available in the repository catalogue and upgrade them from the repository.