MongoDb CLI 安装在 Ubuntu 20.04 focus 上不起作用,代理后面

MongoDb CLI 安装在 Ubuntu 20.04 focus 上不起作用,代理后面

我正在尝试安装 MongoDb CLI(https://docs.mongodb.com/mongocli/master/install/)。我首先运行,wget --no-check-certificate -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | sudo apt-key add -因为运行wget -vO - https://www.mongodb.org/static/pgp/server-5.0.asc | sudo apt-key add -告诉我应该使用“--no-check-certificate”。在命令中添加“--no-check-certificate”后,我得到了证书的“OK”响应。

跑步后echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list我尝试跑步sudo apt-get update并收到

Ign:1 https://repo.mongodb.org/apt/ubuntu/dists focal/mongodb-org/5.0 InRelease
Err:2 https://repo.mongodb.org/apt/ubuntu/dists focal/mongodb-org/5.0 Release
  Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown.  Could not handshake: Error in the certificate verification. [IP: 99.84.102.50 443]
Get:3 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Hit:4 http://archive.ubuntu.com/ubuntu focal InRelease
Hit:5 http://archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:6 http://archive.ubuntu.com/ubuntu focal-backports InRelease
Reading package lists... Done
E: The repository 'https://repo.mongodb.org/apt/ubuntu/dists focal/mongodb-org/5.0 Release' does not have a Release file. 
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

然后我尝试了其他答案板上提到的另一种方法 -您可以在 sources.list 中添加 [trusted=yes]于是我echo "deb [ trusted=yes ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list又跑了sudo apt-get update一次。这次我看到了:

Ign:1 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 InRelease
Hit:2 http://security.ubuntu.com/ubuntu focal-security InRelease
Ign:3 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 Release
Ign:4 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse all Packages
Ign:5 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse amd64 Packages
Hit:6 http://archive.ubuntu.com/ubuntu focal InRelease
Ign:7 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse Translation-en
Ign:8 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse all c-n-f Metadata
Hit:9 http://archive.ubuntu.com/ubuntu focal-updates InRelease
Ign:10 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse amd64 c-n-f Metadata
Ign:4 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse all Packages
Ign:5 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse amd64 Packages
Hit:11 http://archive.ubuntu.com/ubuntu focal-backports InRelease
Ign:7 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse Translation-en
Ign:8 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse all c-n-f Metadata
Ign:10 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse amd64 c-n-f Metadata
Ign:4 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse all Packages
Ign:5 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse amd64 Packages
Ign:7 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse Translation-en
Ign:8 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse all c-n-f Metadata
Ign:10 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse amd64 c-n-f Metadata
Ign:4 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse all Packages
Ign:5 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse amd64 Packages
Ign:7 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse Translation-en
Ign:8 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse all c-n-f Metadata
Ign:10 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse amd64 c-n-f Metadata
Ign:4 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse all Packages
Ign:5 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse amd64 Packages
Ign:7 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse Translation-en
Ign:8 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse all c-n-f Metadata
Ign:10 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse amd64 c-n-f Metadata
Ign:4 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse all Packages
Ign:5 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse amd64 Packages
Ign:7 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse Translation-en
Ign:8 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse all c-n-f Metadata
Ign:10 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse amd64 c-n-f Metadata
Ign:4 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse all Packages
Err:5 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse amd64 Packages
  Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown.  Could not handshake: Error in the certificate verification. [IP: 99.84.102.2 443]
Ign:7 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse Translation-en
Ign:8 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse all c-n-f Metadata
Ign:10 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse amd64 c-n-f Metadata
Reading package lists... Done
E: Failed to fetch https://repo.mongodb.org/apt/ubuntu/dists/focal/mongodb-org/5.0/multiverse/binary-amd64/Packages  Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown.  Could not handshake: Error in the certificate verification. [IP: 99.84.102.2 443]
E: Some index files failed to download. They have been ignored, or old ones used instead.

输出行数增加,效果不错,但问题依然存在。我研究过将密钥环类型改为 gpg(什么命令(确切地)应该取代弃用的 apt-key?) 并使用了[signed-by=/usr/local/share/keyrings/<your-keyfile-name>.gpg]技巧,但这没有帮助。我觉得这不是我遇到的本地证书问题。任何帮助都将不胜感激。

相关内容