Using pkg/portsnap/poudriere for Binary Package Management and Ports Collection in FreeBSD

  • pkg@man is the binary package management tool
(list installed packages)
$ pkg info
(summarize installed versions of packages)
$ pkg version

(install/update/remove/info/search package)
$ pkg install|update|delete|info|search pkgname

(local install)
$ pkg add localpkg.txz

(find which package provide an installed file)
$ pkg which /path/to/my/file
(show reverse dependencies)
$ pkg info -r pkgname
(reverse dependencies)
$ pkg info -d pkgname

(binary upgrade the installed packages)
$ pkg upgrade
(show out of date packages compared to a remote repository)
$ pkg upgrade -n

(audit installed packages)
$ pkg audit -F
(checking for missing dependency and try to fix them)
$ pkg check -d

(automatically removing leaf dependencies)
$ pkg autoremove
(removing stale/old packages)
$ pkg clean

(binary updates for base system)
$ freebsd-update fetch ; freebsd-update install

(create remote repo, see '/etc/pkg/FreeBSD.conf' and 'man pkg-repo')
$ pkg repo /path/to/a/directory/containing/packages

from Using pkg for Binary Package Management and Pkg Primer

  • portsnap@man tool used to fecth and update the FreeBSD ports tree/collection compressed snapshots
(first time; fetch and extract ports collection)
$ portsnap fetch extract
(after fetch and update)
$ portsnap fetch update

(compiling a port and cleaning working directory and dependencies)
$ make -C /usr/ports/category/name install clean clean-depends

(removing installed ports)
$ make -C /usr/ports/category/name deinstall

(list out-of-date installed ports)
$ pkg version -l "<"

from Using the Ports Collection

  • poudriere is BSD-licensed utility for creating and testing FreeBSD packages in a isolated compilation environments. Once built they can be installed using pkg.
$ pkg install poudriere
$ make -C /usr/ports/ports-mgmt/poudriere install clean

(initialize jails and port trees)
$ poudriere jail -c -j 10amd64 -v 10.0-RELEASE
$ poudriere ports -c -p local

(edit specific make.conf)
$ cat /usr/local/etc/poudriere.d/10amd64-local-workstation-make.conf

(edit packages to be built; dependencies will be pulled in automatically)
$ cat /usr/local/etc/poudriere-list

(bulk build)
$ poudriere bulk -f /usr/local/etc/poudriere-list -j 10amd64

(keep package repo update)
$ poudriere ports -u
$ poudriere bulk -f /usr/local/etc/poudriere-list -j 10amd64

(add RSA key for package authentication before building)
$ mkdir -p /usr/local/etc/ssl/keys /usr/local/etc/ssl/certs
$ chmod 600 /usr/local/etc/ssl/keys
$ openssl genrsa -out /usr/local/etc/ssl/keys/pkg.key 4096
$ openssl rsa -in /usr/local/etc/ssl/keys/pkg.key -pubout > /usr/local/etc/ssl/certs/pkg.cert
(copy the 'pkg.cert' file to clients)

(add repo to clients)
$ cat /usr/local/etc/pkg/repos/poudriere.conf
poudriere: {
  url: "http://your-web-server/path/to/repo",
  mirror_type: "http",
  signature_type: "pubkey",
  pubkey: "/usr/local/etc/ssl/certs/pkg.cert",
  enabled: yes
$ pkg update

from Making a binary package repository with poudriere


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s