[debian] apt-get install specific version of package

When you’re adding additional repositories beside the default in your /etc/apt/sources.list, Debian will provide more than one version of package where available. You can use “apt-cache policy package-name” to check the package’s available version. For example, you want to check available ffmpeg version on your repositories, you can use this command:

If you add additional repositories other than default, you may have several version of ffmpeg. This one is the output example on my server (I add debian-multimedia and backports repository beside the default):

Those lines above show you which ffmpeg version is already installed and which one is available on other repository.
Suppose you want to install ffmpeg version 5:0.7.11-0.1 from debian-multimedia repository, you can use this command:

Notice that I put “=” and the version number [omitting the last number (0)] after the package name. That apt-get command will install ffmpeg from debian-multimedia and removing the one from backports that already installed.
When a package have some configuration file (such as Apache with it’s apache2.conf), apt-get will ask you whether to keep your current configuration or use the new version (overwrite the old one).

Leave a Reply

%d bloggers like this: