FreeBSD: Handling Ports and Binary Packages

FreeBSD has several options how to install software and manage it…

Binary Packages

Pretty straightforward usage of pkgng is as follows:

# pkg update
# pkg upgrade
# pkg search PACKAGE
# pkg install PACKAGE
# pkg remove PACKAGE

Very usefull is using the info parameter:

# pkg info PACKAGE

which displays, for instance, “Options” and “Shared Libs required” which was the package compiled with.

Manually

The elementary way to install software is to go to:

# cd /usr/ports

and in the very first “round”, run:

# portsnap fetch extract

which will download and extract the whole tree of ports.

In order to update the ports tree, run:

# portsnap fetch update

In order to find a desired package, run:

# cd /usr/ports
# make search name="PACKAGENAME"

In order to install a desired package, run:

# cd /usr/ports/PATH-TO/PACKAGE
# make config
# make all install clean

source

Portmaster

Portmaster is a tool to manage ports (packages) without external databases or languages.

# cd /usr/ports
# make search name="portmaster"
# cd /usr/ports/ports-mgmt/portmaster
# make all install clean

In order to install a selected port, run (e.g.):

# portmaster foo/fooport

In order to update ports with “interactive” response, run:

# portmaster -ai

source

Mixing Packages and Ports (pkg lock)

In order to prevent pkg from clobbering an installed port, run:

# pkg lock PACKAGE
lock this package? [Y/n] Y
package locked.

Running:

# pkg upgrade

should prevent installation of the locked binary package.

In order to see locked packages, run:

# pkg lock -l
Currently locked packages:

Note: FreeBSD versions earlier than 10.X require the following line in /etc/make.conf:

WITH_PKGNG=yes

source

Issues

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 udpate by:

# pkg update -f
Advertisements
This entry was posted in BSD, Security and tagged , , , , , , . Bookmark the permalink.