Sunday, March 02, 2008

apt-get: Installing specific version of a package

Today I was struggling to install libxml2-dev. The problem is libxml2-dev depends libxml2 version 2.6.30.dfsg-2ubuntu1. But in my machine I already have libxml2 with version 2.6.30.dfsg-2ubuntu1.1. I really don't know how I got this version of of libxml2(I use multiple local repositories). Synaptic doesn't accept this version of libxml2 so I can't neither install libxml2-dev nor remove my version of libxml2 since lot of other packages depends on this.

Finally I found a solution that I can replace installed version of a particular package with another version.

apt-get install libxml2=2.6.30.dfsg-2ubuntu1


Note the equal(=) sign, thats where the magic is. It replaced the existing version of libxml2 with the version I specified. After that I installed libxml2-dev successfully.