Migrate Packages from Host A to Host B

Page content

How to migrate all Packages

Got several Packages installed on Host A and you would like to migrate them to Host B ? That’s easy :)

Extract on Host A

pkg_info -mz | tee list
ansible--
bash--
...
vnstat--
wget--

scp list HostB:/tmp/

Import on Host B

doas pkg_add -l /tmp/list

Oneline

or you can simple do it in one line, although there are two commands. copy and install

target="host.world"; pkg_info -mz |ssh ${target} "cat > /tmp/list"; ssh ${target} "pkg_add -l /tmp/list"

sha256: 7c724c6f6e405f85f1d6235384bd89ceb05dfc1b6968d392bf74a30e958720da