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: , , , , , , ,

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

Anonymous said...

Thanks! This helped me quickly and rather painlessly. :)

V!W! said...

THANKS, having problem with fMMS of N900. This helped me to install previous version to try my luck again!

Kasper said...

Nice to know about this, but what does one do when apt-cache showpkg only shows one version? I have a buggy package installed, and I know older versions don't have this bug, but with showpkg they don't show up.

VMR Global Solutions said...

Thanks Andrew !!

Anonymous said...

thanks, its usefull for me!

Sebastian Kruse said...

Thanks for the nice tutoral to add older packages to my system. So I could fix the latest mercurial issue see: http://kruse-familie.eu/?p=96

Sebastian Kruse said...

Thanks for the nice tutoral to add older packages to my system. So I could fix the latest mercurial issue see: http://kruse-familie.eu/?p=96

Piotr Szeptynski said...

I'd use apt-get policy package_name for less cluttered screen :)

Piotr Szeptynski said...

I would go for apt-cache policy package_name for a less cluttered screen :)

Anonymous said...

AAARGH .. Why Debilan is debil-like .. Othen distros normaly use more specific definition .. name or name-version ..
name = version is mad idea.. too many googling for this .. shit .. die debilan, die ..