Debian – How to keep track of installed software

debianpackage-managementsoftware installationupgrade

Every now and then I'm in need of updating a software running on one of our testservers at work (mostly Debian). What really confuses me almost every time is the fact that there is not just one way to install software. Today I needed to upgrade Coffeescript. I didn't know how it was installed initially and therefore not how to update it the best way.

It could have been installed with apt or manually by cloning the github-project and building it on my own or via the nodejs package manager npm. After I struggled with this and manually threw all coffeescript related files and dirs away I managed to do a fresh install. But then I wanted to use a coffeescript command that needs nodejs 0.6 and 0.4 was installed.

So, let the games begin again!

Was nodejs installed manually? Or as package? Or was it put there by god? I don't know.

So I'm asking myself is there some easy strategy to update installed software when you don't really know how it was intially installed? What are the best approaches here?

Best Answer

There's a simple rule you should follow, which will resolve most cases:

Never put a file under /bin, /lib, /sbin or /usr, except /usr/local, without going through the package manager.

This way, if a file is in the area managed by the package manager, you know it's come from a package. If it's not, you know you installed it manually.

You should stick to packages provided by your distribution whenever possible. Only install third-party packages if you have a documented need for functionality that is not provided by the distribution. “I want to have the latest version” is not a valid justification. If you do install third-party packages, keep notes of where you got them, and archive the packages (.rpm or .deb files) somewhere. Privilege apt or yum sources over random web downloads.

Use stow or xstow for the programs you install manually.

Use etckeeper to keep /etc under version control. Commit whenever you make a change, with a meaningful message.


If you've run into a situation where you did things the dirty way and have lost track where a piece of software comes from:

  • Install a clean version of that software, in the proper location following the advice above.
  • Test that the new installation works for your intended purposes.
  • Switch over your services to use the new installation.
  • Clean up the old installation as best you can.
Related Question