Say I insall apache or mysql etc. on my ubuntu server.
Is it possible to get a report of what was installed and where? (say I want to delete the apache installation).
have a look at /var/log/dpkg.log - any installed packet is listed there
will show where he files went
You can see the content of an installed package by
If you want the list of the installed packages (not the content), check
The purge option in will remove all the files installed during the installation. In some cases it will ask to confirm if you want to keep some of the data used by the package. Directories which are no longer empty will be reported.
The directory /var/lib/dpkg/info has the installation files. The file name is the name of the package, with a variety of extensions for different purposes. The file with a .list extension lists the files and directories which make up the package.
Installations often involve dependencies which are automatically installed. Some tools will mark these files as automatically installed. The initial installation does not do this marking. Automatically removed packes are not purged, so some configuration is left behind. The command 'aptitude purge ~c' will purge any packages which are configured but uninstalled. To list these packages use the command 'aptitude search ~c'.
Using the file limit '!~M' will limit the package display to packages which are not installed as a result of a dependency. With few exceptions all libraries should be installed a a result of a dependency. It you believe a package is installed to support a dependency, you can manally mark it using the 'M' command in aptitude. If it is not require for a package, it will be marked for removal. The undo command 'ctrl-u' will undo this if you really want to keep it.
There are also tools such as deb-orphan which help in removing packages which are a result of dependencies.