I found myself in a situation where I wanted to know the list of installed packages on Debian Lenny 5.0 and compare this list with what was on another server. First for a complete list of packages present on a Debian server I use the excellent dpkg . dpkg-l will give a list of installed packages in alphabetical order with version and description and status, sthg like: gocarto01: ~ # dpkg-l Desired = Unknown / Install / Remove / Purge / Hold ii adduser 3.110 add and remove users and groups ii apache2 2.2.9-10+lenny2 Apache HTTP Server metapackage ii apache2-doc 2.2.9-10+lenny2 Apache HTTP Server documentation ii apache2-mpm-prefork 2.2.9-10+lenny2 Apache HTTP Server - traditional non-threaded model ii apache2-utils 2.2.9-10+lenny2 utility programs for webservers ii apache2.2-common 2.2.9-10+lenny2 Apache HTTP Server common files ii apt 0.7.20.2+lenny1 Advanced front-end for dpkg ii apt-file 2.1.5 APT package searching utility - command-line interface ii apt-utils 0.7.20.2 APT utility lenny1 + Programs ii base-files Debian base system miscellaneous 5lenny2 files ii base-passwd 3.5 .20 Debian base system master password and group files ii bash 3.2-4 The GNU Bourne Again SHell rc bind9 1:9.5.1. dfsg.P1-2 Internet Domain Name Server
with this nice list that are saved in a file by making a simple redirect dpkg-l> package-list_serveur1.txt Then on the other server is doing the same dpkg-l> package-list-serveur2.txt and recovered by the previous list example with scp (ssh tools supplied with) scp server1: package-list_serveur1.txt. And finally just a diff between 2 files and you get the list of packages that one side or the other: diff-package package-list-serveur2.txt list_serveur1.txt > ii php5-gd 5.2.6.dfsg.1-1 + GD module for php5 lenny3 264a270> ii php5-sybase 5.2.6.dfsg.1-1 + lenny3 Sybase / MS SQL Server module for php5
So in this example I can see I'm missing packages php5-gd and php5 sybase-on server2 (because there are only present in the generated list on server1.
Good luck if you try to do the same with Microsoft ... course nothing prevents you to filter this list with a grep So with a:
gocarto01: ~ # dpkg-l PEAR - PHP Extension and application based ii php5-cli 5.2.6.dfsg.1-1 + command-line interpreter lenny3 pour la php5 script ii php5-common
5.2.6.dfsg.1-1 + lenny3 Common files for packages built from the PHP
ii php5-gd 5.2.6.dfsg.1-1 + GD module for php5 lenny3
ii php5-pgsql 5.2.6.dfsg.1-1 + PostgreSQL module for php5 lenny3 a man dpkg will show you lots of other possibilities of this great tool. So if you want to know the list of files installed by package postgresql-8.3-postgis simply launch: dpkg-L-8.3-postgis postgresql gocarto01: ~ # dpkg-L-8.3-postgis postgresql
/. / usr / usr / share
/ usr / share / doc / usr/share/doc/postgresql-8.3-postgis
/ usr/share/doc/postgresql-8.3-postgis/changelog.gz
/ usr / share / doc/postgresql-8.3-postgis/copyright / usr/share/doc/postgresql-8.3-postgis/README.Debian.gz / usr/share/doc/postgresql-8.3-postgis/changelog.Debian.gz
/ usr/share/postgresql-8.3-postgis / usr/share/postgresql-8.3-postgis/lwpostgis_upgrade.sql / usr/share/postgresql-8.3-postgis/lwpostgis.sql
/ usr/share/postgresql-8.3-postgis/spatial_ref_sys.sql
/ usr / lib
/ usr / lib / postgis
/ usr/lib/postgis/1.3.3
/ usr/lib/postgis/1.3.3 /
postgres / usr/lib/postgis/1.3.3/postgres/8.3
/ usr/lib/postgis/1.3.3/postgres/8.3/lib
/ usr/lib/postgis/1.3.3/postgres/8.3/lib / liblwgeom.so.1.3
/ usr / lib / postgresql
/ usr/lib/postgresql/8.3
/ usr/lib/postgresql/8.3/lib
/ usr/lib/postgresql/8.3/lib/liblwgeom.so.1
/ usr/lib/postgresql/8.3/lib/liblwgeom.so