As you can read on FreeBSD Wiki:
Pkg is the Next Generation package management tool for FreeBSD. It is the replacement for the current pkg_info/pkg_create/pkg_add tools that ports use to register local packages and which provide remote packages. Its main goals are to faciliate remote binary package upgrades. It also works with ports without remote binary packages.
Today I started migration to pkg on my FreeBSD 8.4 and 9.3 servers. First of all you should add to file /etc/make.conf this line:
Then I ran pkg:
$ pkg The package management tool is not yet installed on your system. Do you want to fetch and install it now? [y/N]: y Bootstrapping pkg please wait _http._tcp.pkg.FreeBSD.org Installing pkg-1.3.7: 100% Message for pkg-1.3.7: If you are upgrading from the old package format, first run: # pkg2ng
If you haven’t pkg installed, do it:
make -C /usr/ports/ports-mgmt/pkg install clean
Now you should run pkg2ng to convert old package database, but I’ve got error:
$ pkg2ng pkg: PACKAGESITE in pkg.conf is no longer supported. Convert to the new repository style. See pkg.conf(5) pkg: Cannot parse configuration file! Analysing shared libraries, this will take a while... pkg: PACKAGESITE in pkg.conf is no longer supported. Convert to the new repository style. See pkg.conf(5) pkg: Cannot parse configuration file! done
It seems that pkg.conf format has changed, so I ran:
$ mv /usr/local/etc/pkg.conf /usr/local/etc/pkg.conf.old $ cp /usr/local/etc/pkg.conf.sample /usr/local/etc/pkg.conf $ chmod 640 /usr/local/etc/pkg.conf
And then I tried again to run pkg2ng:
$ pkg2ng Converting packages from /var/db/pkg Converting phpMyAdmin-4.1.14... Converting vala-0.20.1_1... Converting php53-sqlite3-5.3.28_2... Converting jasper-1.900.1_12... ...
And last step we should upgrade database of installed ports:
$ pkgdb -fu
Now you can use pkg to install binary packages. portupgrade will also use pkg tool.