我是否需要更改在 Ubuntu 18.04 中添加 xenial 存储库的命令?

我是否需要更改在 Ubuntu 18.04 中添加 xenial 存储库的命令?

我正在关注https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/#install-mongodb-community-edition在 Lubuntu 18.04 上安装 mongodb

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list
sudo apt-get update
sudo apt-get install -y mongodb-org

第二条命令有xenial,我需要将其更改为吗bionic

为什么在我接下来的改变实验中它不起作用?

$ echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list
deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse

$ sudo apt-get update
Get:1 http://security.ubuntu.com/ubuntu bionic-security InRelease [83.2 kB]
Ign:2 http://ppa.launchpad.net/adrozdoff/emacs/ubuntu bionic InRelease                                                                                                           
Ign:3 http://dl.google.com/linux/chrome/deb stable InRelease                                                                                                                     
Hit:4 http://us.archive.ubuntu.com/ubuntu bionic InRelease                                                                                                                       
Get:5 http://us.archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]                                                                                                     
Err:6 http://ppa.launchpad.net/adrozdoff/emacs/ubuntu bionic Release                                                                                                             
  404  Not Found [IP: 91.189.95.83 80]
Hit:7 http://dl.google.com/linux/chrome/deb stable Release                                                                                                                       
Hit:8 https://dl.winehq.org/wine-builds/ubuntu bionic InRelease                                                                                                                  
Get:9 http://us.archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]                                                          
Hit:10 http://repo.mysql.com/apt/ubuntu bionic InRelease                                                                              
Ign:11 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 InRelease                        
Err:12 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 Release    
  404  Not Found [IP: 54.230.36.150 443]
Get:14 http://security.ubuntu.com/ubuntu bionic-security/main amd64 DEP-11 Metadata [204 B]
Get:15 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 DEP-11 Metadata [2,452 B]
Get:16 http://us.archive.ubuntu.com/ubuntu bionic-updates/main amd64 DEP-11 Metadata [138 kB]
Get:17 http://us.archive.ubuntu.com/ubuntu bionic-updates/main DEP-11 48x48 Icons [31.4 kB]
Get:18 http://us.archive.ubuntu.com/ubuntu bionic-updates/main DEP-11 64x64 Icons [53.7 kB]      
Get:19 http://us.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 DEP-11 Metadata [125 kB]
Get:20 http://us.archive.ubuntu.com/ubuntu bionic-updates/universe DEP-11 48x48 Icons [126 kB]  
Get:21 http://us.archive.ubuntu.com/ubuntu bionic-updates/universe DEP-11 64x64 Icons [212 kB]   
Get:22 http://us.archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 DEP-11 Metadata [2,468 B]
Get:23 http://us.archive.ubuntu.com/ubuntu bionic-backports/universe amd64 DEP-11 Metadata [5,100 B]

Reading package lists... Done
E: The repository 'http://ppa.launchpad.net/adrozdoff/emacs/ubuntu bionic 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.
E: The repository 'https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.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.

为什么在我接下来的实验中没有进行任何改变,它却有效了?

$ sudo apt-get install -y mongodb-org
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package mongodb-org

$ echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list
deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0 multiverse

$ sudo apt-get update
Hit:1 http://us.archive.ubuntu.com/ubuntu bionic InRelease
Ign:2 http://dl.google.com/linux/chrome/deb stable InRelease                                                                                                                     
Hit:3 http://us.archive.ubuntu.com/ubuntu bionic-updates InRelease                                                                                                               
Hit:4 http://us.archive.ubuntu.com/ubuntu bionic-backports InRelease                                                                                                             
Ign:5 https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0 InRelease                                                                                                       
Ign:6 http://ppa.launchpad.net/adrozdoff/emacs/ubuntu bionic InRelease                                                                                                           
Hit:7 http://dl.google.com/linux/chrome/deb stable Release                                                                                                 
Hit:8 http://security.ubuntu.com/ubuntu bionic-security InRelease                                                                                                                
Hit:9 http://repo.mysql.com/apt/ubuntu bionic InRelease                                                                                                                          
Get:10 https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0 Release [3,457 B]                                                                                              
Hit:11 https://dl.winehq.org/wine-builds/ubuntu bionic InRelease                                                                                 
Get:12 https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0 Release.gpg [801 B]           
Err:13 http://ppa.launchpad.net/adrozdoff/emacs/ubuntu bionic Release               
  404  Not Found [IP: 91.189.95.83 80]
Get:15 https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0/multiverse arm64 Packages [2,146 B]
Get:16 https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0/multiverse amd64 Packages [2,143 B]
Reading package lists... Done
E: The repository 'http://ppa.launchpad.net/adrozdoff/emacs/ubuntu bionic 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.

$ sudo apt-get install -y mongodb-org
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 mongodb-org : Depends: mongodb-org-server but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

答案1

MongoDB 目前尚未为 bionic 设置 repo,仅为 xenial 设置。这就是为什么如果您将 repo 更改为指向 bionic,则那里什么都没有。

许多 xenial repo 可能与 bionic 兼容,因为许多库和依赖项都很灵活,并且能够在新更新的 Ubuntu 环境中运行。除非遇到不兼容问题,否则请继续使用 xenial repo。一旦 MongoDB 发布 bionic 的 repo,您​​就可以切换。

相关内容