FreeBSD: Handling Ports and Binary Packages
FreeBSD has several options how to install software and manage it…
Pretty straightforward usage of
pkgng is as follows:
# pkg update # pkg upgrade # pkg search PACKAGE # pkg install PACKAGE # pkg remove PACKAGE
Very useful is using the
# pkg info PACKAGE
which displays, for instance,
Shared Libs required that was the package compiled with.
The elementary way to install software is to go to:
# cd /usr/ports
In the very first “round”, in order to download and extract the whole tree of ports, the following needs to be run:
# portsnap fetch extract
In order to update the ports tree, the following needs to be run:
# portsnap fetch update
In order to find a desired package (containing a
SEARCHSTRING), the following needs to be run:
# cd /usr/ports # make search name="SEARCHSTRING"
And finally to install a desired
PACKAGE, the following needs to be run:
# cd /usr/ports/PATH-TO/PACKAGE # make config # make all install clean
More information can be found in the FreeBSD’s Handbook.
Portmaster is a tool to manage ports (packages) without external databases or languages. It can be installed as follows:
# cd /usr/ports # make search name="portmaster" # cd /usr/ports/ports-mgmt/portmaster # make all install clean
In order to install a selected port (package), the following needs to be run:
# portmaster PATH-TO/PACKAGE
In order to update ports with “interactive” response (
-i), the following needs to be run:
# portmaster -ai
More information can be found in the unix.stackexchange.com.
Mixing Packages and Ports (pkg lock)
In order to prevent pkg from clobbering an installed port, the following needs to be run:
# pkg lock PACKAGE lock this package? [Y/n] Y package locked.
Now, the binary packages can be upgraded without touching the locked binary package:
# pkg upgrade
In order to see locked packages, the following needs to be run:
# pkg lock -l Currently locked packages: ...
Note: FreeBSD versions earlier than 10.X require the following line in
If the package repository seems to be updated, but it is not possible to search any package in it (like the following example):
# pkg update Updating FreeBSD repository catalogue... FreeBSD repository is up-to-date. All repositories are up-to-date. # pkg search curl # THIS SEARCH RESULT IS EMPTY
It is necessary to force the update by:
# pkg update -f