This is an old revision of the document!


Pkg Primer

Function legacy pkg_* pkgng
get list of installed packages pkg_info pkg info
get basic information about a package pkg_info pkgname-pkgversion pkg info pkgname OR pkg info category/name OR pkg info pkgname-pkgversion
get detailled information about a package N/A pkg info -f pkgname OR pkg info -f category/name OR pkg info -f pkgname-pkgversion
list all files contained in an installed package pkg_info -L pkgname-pkgversion pkg info -l pkgname OR pkg info -l category/name OR pkg info -l pkgname-pkgversion
find which package provide an installed file pkg_info -W /path/to/my/file pkg which /path/to/my/file
install a local package pkg_add ./localpkg.tbz pkg add ./localpkg.txz
install a remote package pkg_add -r mypackage pkg install mypackage OR pkg install category/name OR pkg install pkgname-pkgversion
search for a remote package N/A pkg search mypackage OR pkg search category/name OR pkg search pkgname-pkgversion
search for detailled informations about a remote package N/A pkg search -f mypackage OR pkg search -f category/name OR pkg search -f pkgname-pkgversion
show reverse dependencies of an installed package pkg_info -R pkgname-pkgversion pkg info -r mypackage OR pkg info -r category/name OR pkg info -r pkgname-pkgversion
show dependencies of an installed package pkg_info -r pkgname-pkgversion pkg info -d mypackage OR pkg info -d category/name OR pkg info -d pkgname-pkgversion
remove unused packages install as a dependency N/A pkg autoremove
binary upgrade the installed packages N/A pkg upgrade
create a remote repository N/A pkg repo /path/to/a/directory/containing/packages
manipulate packages in a jail N/A pkg -j <name_or_id_of_a_jail> <command>
manipulate packages in a chroot pkg_add -C <path_to_chroot> (not all commands are chroot aware) pkg -c <path_to_chroot> <command>
show information about installed packages using regular expression pkg_info -x <regex> pkg info -x <regex>
show information about installed packages using extended regular expression pkg_info -X <regex> pkg info -X <regex>
show information about installed packages using globbing pkg_info <globbing> pkg info -g <globbing>
check for known vulnerability portaudit (third party tool) pkg audit
show out of date packages (determine out of the ports tree) pkg_version -l < pkg version -l <
show out of date packages (determine out of the ports tree index) pkg_version -Il < pkg version -Il <
show out of date packages compared to a remote repository N/A pkg upgrade -n
show statistic about installed packages N/A pkg stat
checking for missing dependency (and try to fix them) N/A pkg check -d

Install poudriere and pkgng on the host (please note that the host do not need to be converted to pkgng)

make -C /usr/ports/ports-mgmt/poudriere install clean
make -C /usr/ports/ports-mgmt/pkg install clean

Create a default configuration in the ${LOCALBASE}/etc/poudriere.conf configuration file:

BASEFS=/poudriere
ZPOOL=myzpool
FREEBSD_HOST=ftp://ftp.freebsd.org
POUDRIERE_DATA=/poudriere_data
RESOLV_CONF=/etc/resolv.conf
DISTFILES_CACHE=/usr/ports/distfiles

poudriere is now ready to be used.

First create a ports tree to be used by poudriere

poudriere ports -c

Create the jail in version you want to build packages for:

poudriere jail -c -j 90amd64 -v 9.0-RELEASE -a amd64
poudriere jail -c -j 10i386 -v head -a i386 -m svn

The first will create a 9.0-RELEASE amd64 jail from the official sets (fetched on FREEBSD_HOST) The second will create a current jail using svn and build for i386

As poudriere works for both legacy pkg_* and pkgng you need to make it pkgng aware:

mkdir /usr/local/etc/poudriere.d
echo "WITH_PKGNG=yes" > /usr/local/etc/poudriere.d/90amd64-make.conf
echo "WITH_PKGNG=yes" > /usr/local/etc/poudriere.d/10i386-make.conf

Create the list of packages you want to see built by poudriere:

cat ~/mylist1
editors/vim-lite
www/nginx
cat ~/mylist2
www/firefox
editors/libreoffice

Just run poudriere:

poudriere bulk -f ~/mylist1 -j 90amd64
poudriere bulk -f ~/mylist2 -j 10i386

This will built 2 pkgng repositories:

  • ${POUDRIERE_DATA}/packages/10i386-default
  • ${POUDRIERE_DATA}/packages/90amd64-default

Configure you http server to those directories to be able to serve them.

On your user boxes: (if you use the automatic bootstrap it will take care of creating this file)

echo "packagesite: http://yoururl/10i386-default" >> /usr/local/etc/pkg.conf
echo "packagesite: http://yoururl/90amd64-default" >> /usr/local/etc/pkg.conf

From 9.1 you can directly bootstrap from the base:

Before 9.1 you will need to boostrap by hand:

fetch http://yoururl/90amd64-default/Latest/pkg.txz
tar xf ./pkg.txz -s ",/.*/,,g" "*/pkg-static"
./pkg-static add ./pkg.txz

To update your repositories just rerun poudriere:

poudriere ports -u # this update your default ports tree
poudriere bulk -f ~/mylist1 -j 90amd64
poudriere bulk -f ~/mylist2 -j 10i386
  • pkgprimer.1350053206.txt.gz
  • Last modified: 2012/10/12 14:46
  • by BaptisteDaroussin