Debian: using apt to install a specific version

Posted on Wednesday 21 May 2008

If you’re like me, you may need to build your own packages in Debian, or perhaps have downloaded different versions of packages to install on your system. Sometimes you’d like to go the other way, though, and install an older version of a package you found in the repository, or even the same version, but a different build.

For example, let’s say you built your own version of perl, say 5.8.8-7blindedbytech1. Then, Debian finally gets the same version of perl into their repositories, say 5.8.8-7etch3. Unfortunately, doing an apt-get dist-upgrade isn’t going to install this version. This is particularly annoying if other packages have dependencies on these perl versions.

What’s one to do? Wouldn’t it be nice if you could specify which version of perl package to install? As it turns out, you can. When you do the apt-get install of the package, follow it by an equal sign (=) and the particular package version you want, e.g:

sudo apt-get install perl=5.8.8-7etch3

Obviously, this will only work if the specific version is in one of your repositories. You can do this with multiple packages, too. In fact, I had to, because perl-base was also a different version:

sudo apt-get install perl=5.8.8-7etch3 perl-base=5.8.8-7etch3

Be careful of dependencies. Don’t just blindly run these commands unless you know what you’re doing, and be sure to read the output messages, as it may have unintended effects. For instance, for me, the above command uninstalled mysql-server. Make sure you read the warnings it gives you, and you understand what they mean.

No comments have been added to this post yet.

Leave a comment

(required)

(required)


Information for comment users
Line and paragraph breaks are implemented automatically. Your e-mail address is never displayed. Please consider what you're posting.

Use the buttons below to customise your comment.


RSS feed for comments on this post | TrackBack URI