How to install a specific version of a Debian package using apt-get

At work we use a backported version of Subversion as the stable package is 1.1.4 and I wanted to install the latest one we could get a package for which was version 1.3.2. Along with the backported Subversion package is a package that contains a number of useful hook scripts called subversion-tools.

When I did an apt-get install subversion-tools Debian wanted to install the 1.1.4 stable release not the 1.3.2 backported release. By doing an apt-cache show subversion-tools I was able to see the two available packages.

These are the steps I went through to install the backported version of subversion-tools, although these steps will work when installing any specific version of a Debian package.

Before you install a specific version of a package you need it's complete version.
This will be displayed when you run:
apt-cache showpkg <package name>

e.g.
apt-cache showpkg subversion-tools

> Package: subversion-tools
> Versions:
> 1.3.2-5~bpo1(/var/lib/dpkg/status)
> 1.1.4-2 (/var/lib/apt/lists/ftp.uk.debian.org_debian_dists_stable_main_binary-i386_Packages)


To install the specific version simply run run:
apt-get install <package name>=<version>

e.g.
apt-get install subversion-tools=1.3.2-5~bpo1

Technorati Tags: , , , , , , ,

4 Comments:

Deepak Mittal said...

Thanks Andrew. This is probably the second time your blog has helped me.

abeacock said...

Deepak,

Glad to be of some help! :)

adam said...

Thanks for this. What google couldnt easily find in the official docs (buried too deep) your blog supplied :)

It leaves me speechless that tools so thoroughly critical to running Debian as apt-get and aptitude are still so horrendously user-unfriendly. I've been using apt for almost 10 years now and it's still a nightmare of having to memorize huge amounts of obscure knowledge (and I also just had to manually up my apt cache to defeat the dreaded MMap error - an error which should be avoidable anyway, but at the very least ought to tell you what to do!).

abeacock said...

Adam,

I know exactly how you feel! That is one of the main reasons for my blog, so that I can capture stuff that I couldn't find out on the web how to do.