apt-get 无法安装 apt-cache 策略中列出的特定版本

apt-get 无法安装 apt-cache 策略中列出的特定版本

我正在尝试使用 apt-get 从第三方存储库安装特定版本的 redis-server,该版本在 apt-cache 策略中列出,但无法安装。例如:

$ 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

如果我尝试安装 redis-server 而不选择软件包版本,它会尝试安装我尝试指定的版本:

$ 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])

尝试各种形式的版本号似乎不起作用:

$ 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

答案1

2:版本号的一部分。指定版本时不要忘记添加它:

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

相关内容