9

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?

acme
  • 325

3 Answers3

8

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.
1

I can suggest you to use the puppet for tracking the installed software in linux.

Puppet, an automated administrative engine for your *nix systems, performs administrative tasks (such as adding users, installing packages, and updating server configurations) based on a centralized specification.

You can refer the link

Mughil
  • 1,973
  • Thanks for the link! But I need something on the command line. At first glance, puppet only works with on a desktop system. – acme Feb 16 '12 at 08:37
1

If you install any package using apt-get, all the dependent packages will get install by itself because apt-get resolves all the dependencies.

In my case, I try to install every package by command line using apt-get as far as the package is there in the Ubuntu repositories. If it is not present in their repository, then you have to read the installation manual of that utility and install it based upon whether the utility uses Makefile or something else.