I just add some problems with my Debian virtual servers and I add to reinstall all of them from scratch. However, I still had access to the old version and I could retrieve the list of installed packages.
In order to facilitate the process of restoring a virtual server in the future, I would like to create a list of specific packages for each one of my server.
To better explain what I want to achieve. I already have an automated process to create a new virtual server with some basic package and configuration used everywhere. Now I want to save the delta with this "skeleton" to ease the reinstallation of a particular server.
A real plus will be to also save the changed configuration files from the default, but I can live with only the package list.
In short, I want a way to create a list of packages installed on a host but not on another.
It will be really great if the list contains only manually installed packages and not the list of all dependencies.
If you have some existing tools which are designed to achieve this particular task, feel free to propose them, but I want to keep the dependency as small as possible. For information, they're not exactly virtual servers, but LXC containers.
On the reference installation (only once):
(The following assumes
bash
)To get the packages added from the reference installation (this doesn't show what was removed):
Even better, avoiding copy of
baselist.txt
:on old server, run:
copy the above file to new server and run this on new server:
Also, remember to add all the extra repositories from
/etc/apt/sources.list
from old server to new server as well, before this migration of packages, as if you do not, then most packages will be left un-installed.You can use the following command to get the full list of packages on both servers:
Then, you can get the differences using:
You can filter the needed changes using grep. Also, diff can be used to get the changes in configuration files and generate patches to be appåied when needed. By the way, diff can compare two folders not only two files.
Blueprint is designed for exactly your need. It spits a description packages installed and config files that have been changed. It's able to convert these descriptions into Puppet or Chef scripts in order to apply them to clean boxes.
Also found this helpful package, the description of which is as follows:
A Bash script which compares the filesystem tree of a Debian package to the current filesystem tree, printing unified diffs for files that differ.
https://code.google.com/p/dpkg-diffs/
Just a single bash file you can stick in your PATH somewhere and run - seems to work for me and its not too old.
Hope this helps someone.