Use Apt-Get Install Specific Version Of Package

Using apt-get command to install specific version of package in Ubuntu Linux. Ubuntu users can install package from previous release or install a specific version of a package.

A specific version of a package can be selected for installation by following the package name with an equals and the version of the package to select. This will cause that version to be located and selected for install. Alternatively a specific distribution can be selected by following the package name with a slash and the version of the distribution or the Archive name (stable, frozen, unstable).

For example, you could do:

sudo apt-get update
sudo apt-get install apache2=2.2.20-1ubuntu1

Note that you may need to do some dependency resolution on your own in this case, but if there are any problems apt-get will tell you what is causing them.

Check all the available version of a package

Use the apt-cache command to check the version of the package installed on your system plus all available packages in the Ubuntu repository. You can either run “apt-cache policy firefox” or “apt-cache madiosn firefox”. Please note that the firefox in the said command is the name of the package. if ypu are looking for some other package, name it there.


apt-cache policy firefox


apt-cache madison firefox

This is the output on my system
sourcedigit@SD:~$ apt-cache madison firefox
firefox | 59.0~b14+build1-0ubuntu0.16.04.1 | http://ppa.launchpad.net/mozillateam/firefox-next/ubuntu xenial/main i386 Packages
firefox | 45.0.2+build1-0ubuntu1 | http://archive.ubuntu.com/ubuntu xenial/main i386 Packages
sourcedigit@SD:~$ apt-cache policy firefox
firefox:
Installed: 59.0~b9+build1-0ubuntu0.16.04.1
Candidate: 59.0~b14+build1-0ubuntu0.16.04.1
Version table:
59.0~b14+build1-0ubuntu0.16.04.1 500
500 http://ppa.launchpad.net/mozillateam/firefox-next/ubuntu xenial/main i386 Packages
*** 59.0~b9+build1-0ubuntu0.16.04.1 100
100 /var/lib/dpkg/status
45.0.2+build1-0ubuntu1 500
500 http://archive.ubuntu.com/ubuntu xenial/main i386 Packages

Install a specific version of a package

Run the following command to install a specific version of a package {Firefox in our example}.

apt-get install package=version -V

So the code becomes “sudo apt install firefox=45.0.2+build1-0ubuntu1” which needs to be executed.

apt-get install -s package

-s is the parameter to simulate the installation so that no erroe is encountered during the installation process.

Use Apt-Get Install Specific Version Of Package originally posted on Source Digit – Latest Technology, Gadgets & Gizmos.