由于缺少软件包,无法安装 ruby

由于缺少软件包,无法安装 ruby

我正在尝试安装 Ruby,以便使用 Jekyl 生成静态站点。

我正在遵循https://www.ruby-lang.org/en/documentation/installation/

并发现了一个迫在眉睫的问题:

$ sudo apt-get 安装 ruby​​-full

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  fonts-lato javascript-common libgmp-dev libgmpxx4ldbl libjs-jquery libruby2.7 rake ri ruby ruby-dev ruby-minitest ruby-net-telnet
  ruby-power-assert ruby-test-unit ruby-xmlrpc ruby2.7 ruby2.7-dev ruby2.7-doc rubygems-integration unzip zip
Suggested packages:
  apache2 | lighttpd | httpd gmp-doc libgmp10-doc libmpfr-dev bundler
The following NEW packages will be installed:
  fonts-lato javascript-common libgmp-dev libgmpxx4ldbl libjs-jquery libruby2.7 rake ri ruby ruby-dev ruby-full ruby-minitest ruby-net-telnet
  ruby-power-assert ruby-test-unit ruby-xmlrpc ruby2.7 ruby2.7-dev ruby2.7-doc rubygems-integration unzip zip
0 upgraded, 22 newly installed, 0 to remove and 123 not upgraded.
Need to get 9907 kB of archives.
After this operation, 58.8 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu focal/main amd64 fonts-lato all 2.0-2 [2698 kB]
Get:2 http://archive.ubuntu.com/ubuntu focal/main amd64 javascript-common all 11 [6066 B]
Get:3 http://archive.ubuntu.com/ubuntu focal/main amd64 libgmpxx4ldbl amd64 2:6.2.0+dfsg-4 [9128 B]
Get:4 http://archive.ubuntu.com/ubuntu focal/main amd64 libgmp-dev amd64 2:6.2.0+dfsg-4 [320 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal/main amd64 libjs-jquery all 3.3.1~dfsg-3 [329 kB]
Get:6 http://archive.ubuntu.com/ubuntu focal/main amd64 rubygems-integration all 1.16 [5092 B]
Err:7 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 ruby2.7 amd64 2.7.0-5ubuntu1.1
  404  Not Found [IP: 2001:67c:1360:8001::23 80]
Get:8 http://archive.ubuntu.com/ubuntu focal/main amd64 ruby amd64 1:2.7+1 [5412 B]
Get:9 http://archive.ubuntu.com/ubuntu focal/main amd64 rake all 13.0.1-4 [61.6 kB]
Get:10 http://archive.ubuntu.com/ubuntu focal/main amd64 ruby-minitest all 5.13.0-1 [40.9 kB]
Get:11 http://archive.ubuntu.com/ubuntu focal/main amd64 ruby-net-telnet all 0.1.1-2 [12.6 kB]
Get:12 http://archive.ubuntu.com/ubuntu focal/main amd64 ruby-power-assert all 1.1.7-1 [11.4 kB]
Get:13 http://archive.ubuntu.com/ubuntu focal/main amd64 ruby-test-unit all 3.3.5-1 [73.2 kB]
Get:14 http://archive.ubuntu.com/ubuntu focal/main amd64 ruby-xmlrpc all 0.3.0-2 [23.8 kB]
Err:15 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libruby2.7 amd64 2.7.0-5ubuntu1.1
  404  Not Found [IP: 2001:67c:1360:8001::23 80]
Err:16 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 ruby2.7-doc all 2.7.0-5ubuntu1.1
  404  Not Found [IP: 2001:67c:1360:8001::23 80]
Get:17 http://archive.ubuntu.com/ubuntu focal/universe amd64 ri all 1:2.7+1 [4520 B]
Err:18 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 ruby2.7-dev amd64 2.7.0-5ubuntu1.1
  404  Not Found [IP: 2001:67c:1360:8001::23 80]
Get:19 http://archive.ubuntu.com/ubuntu focal/main amd64 ruby-dev amd64 1:2.7+1 [4632 B]
Get:20 http://archive.ubuntu.com/ubuntu focal/universe amd64 ruby-full all 1:2.7+1 [2728 B]
Get:21 http://archive.ubuntu.com/ubuntu focal/main amd64 unzip amd64 6.0-25ubuntu1 [169 kB]
Get:22 http://archive.ubuntu.com/ubuntu focal/main amd64 zip amd64 3.0-11build1 [167 kB]
Fetched 3944 kB in 2s (1968 kB/s)
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/r/ruby2.7/ruby2.7_2.7.0-5ubuntu1.1_amd64.deb  404  Not Found [IP: 2001:67c:1360:8001::23 80]
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/r/ruby2.7/libruby2.7_2.7.0-5ubuntu1.1_amd64.deb  404  Not Found [IP: 2001:67c:1360:8001::23 80]
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/r/ruby2.7/ruby2.7-doc_2.7.0-5ubuntu1.1_all.deb  404  Not Found [IP: 2001:67c:1360:8001::23 80]
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/r/ruby2.7/ruby2.7-dev_2.7.0-5ubuntu1.1_amd64.deb  404  Not Found [IP: 2001:67c:1360:8001::23 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

我使用 --fix-missing 选项重新运行了该命令,但没有任何效果。我该如何修复此问题?

答案1

讯息

Err:15 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libruby2.7 amd64 2.7.0-5ubuntu1.1
  404  Not Found [IP: 2001:67c:1360:8001::23 80]

是因为版本2.7.0-5ubuntu1.1不再存在于focal-updates远程服务器上的存储库中 - 更新后的版本是

$ apt policy libruby2.7
libruby2.7:
  Installed: (none)
  Candidate: 2.7.0-5ubuntu1.2
  Version table:
     2.7.0-5ubuntu1.2 500
        500 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages
     2.7.0-5ubuntu1 500
        500 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages 

根本问题是您的本地存储库目录已过时 - 建议在尝试从存储库安装软件之前始终更新它:

sudo apt-get update

sudo apt-get install ruby-full

相关内容