Home » » How to Install and Remove Packages in FreeBSD

How to Install and Remove Packages in FreeBSD


If you have used Linux servers, you are probably very familiar with the package management systems, such as YUM or APT. Unless you used Gentoo, however, you may find the package management system in FreeBSD to be noticeably different. What follows is a quick start guide to FreeBSD’s package management system called Ports Collection and the simple binary pkg_add option.
First, to install a precompiled binary package, you can use the simple pkg_add command.

pkg_add -r packagename

To remove a package, use the pkg_delete command:

pkg_delete

Unlike pkg_add, ports is designed to add flexibility and optimization but does not have the speed of a quick install. It will build the package from source, but it is still much easier than building it yourself manually.
The Ports Collection is simply a set of make files and patches. You can usually find them at /usr/ports.
First, to find the package you want to install, type:

whereis packagename

It will give you the output like this:

packagename: /usr/ports/pp/packagename

To install:

cd /usr/ports/pp/packagename

make install clean

Ports will generally take longer than pkg_add since the packages must be compiled. Once it is done, that is all it takes to get a package installed in FreeBSD.

source: http://www.serverschool.com