January 14, 2018 tim 0Comment

In this tutorial we will cover how to export a list of all packages and their dependencies that have been installed via pkgng. This is useful when you need to rebuild a system from scratch or setup a new FreeBSD server that requires the same packages as an existing system. This is how we do it.

On existing system run

pkg prime-list > requirements.txt

make a copy of requirements.txt  so you will have it in a time of need, or if you are just building an identical system copy it to the system using scp like so

scp requirements.txt username@host:/some/remote/folder/

On the system you want to install the packages on run the below command in the same folder that requirements.txt is stored.

pkg install -y `cat requirements.txt`