I want to install to PC2 all the packages, that were installed by apt install
on PC1. That is for Debian, but i think that since Debian and Ubuntu share same package system - the solution would be same. How to do that?
Asked
Active
Viewed 7,751 times
5

xakepp35
- 307
1 Answers
5
First, make sure that /etc/apt/sources.list
and /etc/apt/sources.list.d
on PC2 are equal to those on PC1.
Then, on PC1, do
dpkg --get-selections > installed-packages
apt-key exportall > repo-keys
Transfer the files installed-packages
and repo-keys
to PC2, and do
sudo apt-get install dselect
sudo apt-key add repo-keys
sudo dpkg --set-selections < installed-packages
sudo apt-get dselect-upgrade -y
If you don't have any packages installed from PPA's you can skip the repo-keys commands.
Disclaimer: this used to work a few years ago, I haven't had the need to try it recently.

Jos
- 29,224
-
What would happen, if some packages were installed offline, by
dpkg -i super_private_nda_package.deb
? Would a whole install fail? Or just that packages skipped? Or that packages with their dependencies? – xakepp35 Nov 13 '18 at 14:15 -
I believe
super_private_nda_package
would also end up ininstalled-packages
. – Jos Nov 13 '18 at 14:18 -
I mean
dselect-upgrade
- would command fail when it determines thatsuper_private
does not exists? Or would it just skip that and install everything else? there are several possible behaviours, when you meet an error: rollback everything(as command never happened), stop at error(every package beroresurer_
is installed, every package after it is not), or ignore error (every package, butsuper_
and its deps is installed) – xakepp35 Nov 13 '18 at 14:22 -
1On PC2 the
apt-get dselect-upgrade
is basically anapt install [list of packages...]
, which checks if it can find all packages mentioned. If not, it stops and will not install anything. – Jos Nov 13 '18 at 14:25 -
So nothing would be installed, if some package on list "does not exist" (either
sources.list
differs, either package was downloaded offline and manually installed) Right? – xakepp35 Nov 13 '18 at 14:26 -
apt
. Version is not of importance, in context of question, lets take some generic latest version. – xakepp35 Nov 13 '18 at 13:56