Ports vs Packages on FreeBSD

Many people know about the FreeBSD ports tree but complain that installing software via source code is time-consuming. Those people may not know about FreeBSD's precomplied packages that can be added with the following simple syntax: 'pkg_add -vr packagename'. For example:

orr:/root# pkg_add -vr tcpdstat
looking up ftp.freebsd.org
connecting to ftp.freebsd.org:21
setting passive mode
opening data connection
initiating transfer
Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-
5.3-release/Latest/tcpdstat.tbz...x +CONTENTS
x +COMMENT
x +DESC
x +MTREE_DIRS
x bin/tcpdstat
tar command returns 0 status
Done.
extract: Package name is tcpdstat-0.9
extract: CWD to /usr/local
extract: /usr/local/bin/tcpdstat
extract: CWD to .
Running mtree for tcpdstat-0.9..
mtree -U -f +MTREE_DIRS -d -e -p /usr/local >/dev/null
Attempting to record package into /var/db/pkg/tcpdstat-0.9..
Package tcpdstat-0.9 registered in /var/db/pkg/tcpdstat-0.9

If you want to avoid the potential load on the main FTP server, set an alternate package site:

orr:/root# setenv PACKAGESITE ftp://ftp2.freebsd.org/pub/FreeBSD/ports/
i386/packages-5.3-release/Latest/

Now install the package as desired:

orr:/root# pkg_add -vr srm
looking up ftp2.freebsd.org
connecting to ftp2.freebsd.org:21
setting passive mode
opening data connection
initiating transfer
Fetching ftp://ftp2.freebsd.org/pub/FreeBSD/ports/i386/packages-5.3
-release/Latest/srm.tbz...x +CONTENTS
x +COMMENT
x +DESC
x +MTREE_DIRS
x bin/srm
x man/man1/srm.1.gz
tar command returns 0 status
Done.
extract: Package name is srm-1.2.6
extract: CWD to /usr/local
extract: /usr/local/bin/srm
extract: /usr/local/man/man1/srm.1.gz
extract: CWD to .
Running mtree for srm-1.2.6..
mtree -U -f +MTREE_DIRS -d -e -p /usr/local >/dev/null
Attempting to record package into /var/db/pkg/srm-1.2.6..
Package srm-1.2.6 registered in /var/db/pkg/srm-1.2.6

Notice how the system retrieved the package from ftp2.freebsd.org, not ftp.freebsd.org as per the default settings.

Comments

Anonymous said…
Such method much more simplifies installation of the programs...

Popular posts from this blog

Zeek in Action Videos

New Book! The Best of TaoSecurity Blog, Volume 4

MITRE ATT&CK Tactics Are Not Tactics