Archive

Posts Tagged ‘apt-get’

apt-get: install software/packages in specific version

February 5, 2018 Leave a comment

Sometimes there is a need to install a specific version of software for it to be compatible to other software, already have certain bug fixed, or because we need specific features. And sometimes there are multiple versions of the software available in the repos of your Linux machine, which allows for selecting the version that you want to have instead of just installing the default version. With apt this is possible – however, be careful to not install incompatible versions of software that causes conflicts with other things on your machine.

We are now going to demonstrate installing a specific version of fish, the user friendly interactive shell. At the time of writing there is only version 2.2.0.3 available in the Ubuntu 16.04.3 repositories, but we need at least version 2.3.x, as this is where fish became compatible to fzf, the fuzzy command-line finder (which is a very helpful tool btw). At the time of writing the latest version of fish in the Ubuntu PPA of fish 2.x is 2.7.x. We therefore at first need to add its PPA to make the version we need available to apt:

sudo apt-add-repository ppa:fish-shell/release-2
sudo apt-get update
sudo apt-get install fish

Now, to see all versions of the desired package available for installation on your machine with apt execute:

apt-cache madison fish

In our example we see:

fish | 2.7.0-1~xenial | http://ppa.launchpad.net/fish-shell/release-2/ubuntu xenial/main amd64 Packages
fish |    2.2.0-3 | http://fi.archive.ubuntu.com/ubuntu xenial/universe amd64 Packages

We can also look at some more details with:

apt-cache policy fish

In our example we see:

fish:
  Installed: (none)
  Candidate: 2.7.0-1~xenial
  Version table:
     2.7.0-1~xenial 500
        500 http://ppa.launchpad.net/fish-shell/release-2/ubuntu xenial/main amd64 Packages
     2.2.0-3 500
        500 http://fi.archive.ubuntu.com/ubuntu xenial/universe amd64 Packages
        100 /var/lib/dpkg/status

where 2.7.0-1~xenial is the exact identifier of the version we want to install for our scenario. We can now install this version using apt by setting the additional SW parameter:

sudo apt-get install SW=version

which in case of our example is:

sudo apt-get install fish=2.7.0-1~xenial

Done!