Ubuntu – apt-get cannot install specific version listed in apt-cache policy

aptapt-cacheversions

I'm trying to install a particular version of redis-server from a third-party repo using apt-get, that's listed in apt-cache policy, but cannot be installed. For example:

$ apt-cache policy redis-server
redis-server:
  Installed: (none)
  Candidate: 2:2.8.19-1chl1~trusty1
  Version table:
     2:2.8.19-1chl1~trusty1 0
        500 http://ppa.launchpad.net/chris-lea/redis-server/ubuntu/ trusty/main amd64 Packages
     2:2.8.4-2 0
        500 http://us.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages

$ apt-get install redis-server=2.8.19-1chl1~trusty1
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Version '2.8.19-1chl1~trusty1' for 'redis-server' was not found

If I try and install redis-server without picking a package version, it tries to install the version I've tried to specify:

$ apt-get -s install redis-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  libjemalloc1 redis-tools
The following NEW packages will be installed:
  libjemalloc1 redis-server redis-tools
0 upgraded, 3 newly installed, 0 to remove and 81 not upgraded.
Inst libjemalloc1 (3.6.0-1chl1~trusty1 redis-server:14.04/trusty [amd64])
Inst redis-tools (2:2.8.19-1chl1~trusty1 redis-server:14.04/trusty [amd64])
Inst redis-server (2:2.8.19-1chl1~trusty1 redis-server:14.04/trusty [amd64])
Conf libjemalloc1 (3.6.0-1chl1~trusty1 redis-server:14.04/trusty [amd64])
Conf redis-tools (2:2.8.19-1chl1~trusty1 redis-server:14.04/trusty [amd64])
Conf redis-server (2:2.8.19-1chl1~trusty1 redis-server:14.04/trusty [amd64])

Trying various forms of the version number doesn't seem to work:

$ apt-get install redis-server=2.8.19-1chl1
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Version '2.8.19-1chl1' for 'redis-server' was not found

$ apt-get install redis-server=2.8.19-1
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Version '2.8.19-1' for 'redis-server' was not found

$ apt-get install redis-server=2.8.19
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Version '2.8.19' for 'redis-server' was not found

Best Answer

The 2: is part of the version number. Don't forget to add it when specifying the version:

apt-get install redis-server=2:2.8.19-1chl1~trusty1