Thursday, November 28, 2013

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

I know so many people face a problem that the sources.list file which include the repo URLs where their system get the packages from all of these repos in that file, and the problem mostly happens when users install a recent or old version of the OS but they really need specific version of the package not the default one that apt-get usually grabs from the repos.

I usually face the same problem mostly when building something from scratch and really need specific version, here is how to follow up specific version if it exists on these repos, if not you gotta get the source code and compile it by yourself.

For example, when doing $ sudo apt-get install binutils
I was able to install binutils-2.22.6 but I really needed to install binutils-2.20.2 here is how to go for it.

$ sudo apt-cache show binutils
I was able to see the version I needed and then you might have more than one version exists, so what to do to get the specific one you need:

$ sudo apt-get install <package_name>=<package_version>
EX
$ sudo apt-get install binutils=2.20.6

This should be working fine ;-)

Cheers,