I have the above running in a daily cronjob that checks the dpgklist into SVN as part of our server inventory. This will allow you to keep a reasonable accurate inventory of installed packages across your servers and its easy to do a quick side-by-side diff to see if a server is missing a particular package.
aptitude also satisfies this usecase, and it preserves information about "automatically installed" packages that other methods do not. Run the following on the reference machine:
[...]
dpkg: warning: package not in database at line 302: xfonts-utils
dpkg: warning: found unknown packages; this might mean the available database
is outdated, and needs to be updated through a frontend method
pi@FHEM-new:/tmp $ sudo apt-get dselect-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
I was trying to install the same packages from my old Raspberry Pi (running Raspbian GNU/Linux 7 (wheezy)) on my new Raspberry (Raspbian GNU/Linux 8 (jessie)).
To backup:
To Restore:
Also see this question for additional options and info: Ubuntu, how to setup a new machine like an existing one
I have the above running in a daily cronjob that checks the dpgklist into SVN as part of our server inventory. This will allow you to keep a reasonable accurate inventory of installed packages across your servers and its easy to do a quick side-by-side diff to see if a server is missing a particular package.
aptitude
also satisfies this usecase, and it preserves information about "automatically installed" packages that other methods do not. Run the following on the reference machine:Copy
package_list
to the other machine and runThat's a good idea, and you might also set up one server with apt-proxy if you make a habit of this.
faultyservers answer worked for me only after running a different command as per http://rayslinux.blogspot.de/2012/10/ubuntu-1210-dpkg-warning-package-not-in.html
sudo apt-get install dselect sudo dselect access sudo dselect update
Before that running
sudo apt-get dselect-upgrade
only returned
I was trying to install the same packages from my old Raspberry Pi (running Raspbian GNU/Linux 7 (wheezy)) on my new Raspberry (Raspbian GNU/Linux 8 (jessie)).
In recent versions of Debian/Ubuntu/Mint,
dpkg
needs available packages to be in its "avail" database fordpkg --set-selections
to work.Example sequence:
dpkg --get-selections > installed.dselect
sudo apt update
apt-cache dumpavail | sudo dpkg --merge-avail
sudo dpkg --set-selections < installed.dselect
sudo apt-get dselect-upgrade
The third command populates dpkg's "avail" database. It's important to run this before setting the selections of which additional packages to install.
This reqires dpkg v1.17.7 and later. See Q: Why does ''dpkg --set-selections'' not record selections for unknown packages? on the Debian wiki for more details.