E: 无法定位包 mongodb-org

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28945921/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 20:20:00  来源:igfitidea点击:

E: Unable to locate package mongodb-org

mongodbubuntuinstallation

提问by anonn023432

I am trying to download mongodb and I am following the steps on this link.

我正在尝试下载 mongodb,我正在按照此链接上的步骤操作。

But when I get to the step:

但是当我走到这一步时:

sudo apt-get install -y mongodb-org

I get the following error:

我收到以下错误:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package mongodb-org  //This is the error

Why is this occurring and is there a work around?

为什么会发生这种情况,是否有解决方法?

回答by Naim Rajiv

I faced same issue but fix it by the changing the package file section command. The whole step that i followed was:

我遇到了同样的问题,但通过更改包文件部分命令来修复它。我遵循的整个步骤是:

At first try with this command: sudo apt-get install -y mongodb

首先尝试使用此命令:sudo apt-get install -y mongodb

This is the unofficial mongodb package provided by Ubuntu and it is not maintained by MongoDB and conflict with MongoDB's offically supported packages.

这是 Ubuntu 提供的非官方 mongodb 包,不由 MongoDB 维护,与 MongoDB 官方支持的包冲突。

If the above command not working then you can fix the issue by one of the bellow procedure:

如果上述命令不起作用,那么您可以通过以下程序之一解决问题:

#Step 1:  Import the MongoDB public key
#In Ubuntu 18.*+, you may get invalid signatures. --recv value may need to be updated to EA312927. 
#See here for more details on the invalid signature issue: [https://stackoverflow.com/questions/34733340/mongodb-gpg-invalid-signatures][1]

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10

#Step 2: Generate a file with the MongoDB repository url
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list

#Step 3: Refresh the local database with the packages
sudo apt-get update

#Step 4: Install the last stable MongoDB version and all the necessary packages on our system
sudo apt-get install mongodb-org

         #Or
# The unofficial mongodb package provided by Ubuntu is not maintained by MongoDB and conflict with MongoDB's offically supported packages. Use the official MongoDB mongodb-org packages, which are kept up-to-date with the most recent major and minor MongoDB releases.
sudo apt-get install -y mongodb 

Hope this will work for you also. You can follow this MongoDB

希望这也适用于您。你可以关注这个MongoDB

UpdateThe above instruction will install mongodb 2.6 version, if you want to install latest version for Uubuntu 12.04then just replace above step 2and follow bellow instruction instead of that:

更新以上说明将安装 mongodb 2.6 版本,如果您想安装最新版本,Uubuntu 12.04只需替换上面的内容step 2并按照以下说明进行操作:

#Step 2: Generate a file with the MongoDB repository url
echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb.list

If you are using Ubuntu 14.04then use bellow step instead of above step 2

如果您正在使用,请Ubuntu 14.04使用下面的步骤而不是上面的步骤step 2

#Step 2: Generate a file with the MongoDB repository url
echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list

回答by John D

The true problem here may be if you have a 32-bitsystem. MongoDB 3.X was never made to be used on a 32-bit system, so the repostories for 32-bit is empty (hence why it is not found). Installing the default 2.X Ubuntu package might be your best bet with:

如果您使用的是32 位系统,那么这里真正的问题可能是。MongoDB 3.X 从未用于 32 位系统,因此 32 位系统的存储库是空的(因此找不到它)。安装默认的 2.X Ubuntu 软件包可能是您最好的选择:

sudo apt-get install -y mongodb 


Another workaround, if you nevertheless want to get the latest version of Mongo:


另一种解决方法,如果您仍然想获得最新版本的 Mongo:

You can go to https://www.mongodb.org/downloadsand use the drop-down to select "Linux 32-bit legacy"

您可以访问 https://www.mongodb.org/downloads并使用下拉菜单选择“Linux 32-bit legacy”

But it comes with severe limitations...

但它有严重的局限性......

This 32-bit legacy distribution does not include SSL encryption and is limited to around 2GB of data. In general you should use the 64 bit builds. See herefor more information.

此 32 位旧版发行版不包括 SSL 加密,并且仅限于大约 2GB 的数据。一般来说,您应该使用 64 位版本。请参阅此处了解更多信息。

回答by John D

Try without '-org':

尝试不使用“-org”:

sudo apt-get install -y mongodb

sudo apt-get install -y mongodb

Worked for me!

对我来说有效!

回答by bmvakili

I'm running Ubuntu 14.04; and apt still couldn't find package; I tried all the answers above and more. The URL that worked for me is this:

我正在运行 Ubuntu 14.04;并且 apt 仍然找不到包;我尝试了上面的所有答案以及更多。对我有用的 URL 是这样的:

echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list

Source: http://www.liquidweb.com/kb/how-to-install-mongodb-on-ubuntu-14-04/

来源:http: //www.liquidweb.com/kb/how-to-install-mongodb-on-ubuntu-14-04/

回答by Amit Sharma

All steps are correct just change the Step 4 as below

所有步骤都正确,只需将步骤 4 更改为如下

  • Step 4: Install the last stable MongoDB version and all the necessary packages on our system
  • 第 4 步:在我们的系统上安装最后一个稳定的 MongoDB 版本和所有必要的包

Command: sudo apt-get install mongodb

命令: sudo apt-get install mongodb

It has worked for me.

它对我有用。

回答by Khonix

If you are currently using the MongoDB 3.3 Repository(as officially currently suggested by MongoDB website)you should take in consideration that the package name used for version 3.3 is:

如果您当前正在使用MongoDB 3.3 存储库(如 MongoDB 网站目前官方建议的那样),您应该考虑用于 3.3 版的包名称是:

mongodb-org-unstable

mongodb-org-unstable

Then the proper installation command for this version will be:

那么这个版本的正确安装命令将是:

sudo apt-get install -y mongodb-org-unstable

Considering this, I will rather suggest to use the current latest stable version (v3.2)until the v3.3 becomes stable, the commands to install it are listed below:

考虑到这一点,我宁愿建议使用当前最新的稳定版本(v3.2),直到 v3.3 稳定为止,下面列出了安装它的命令:

Download the v3.2 Repository key:

下载 v3.2 存储库密钥:

wget -qO - https://www.mongodb.org/static/pgp/server-3.2.asc | sudo apt-key add -

If you work with Ubuntu 12.04or Mint 13add the following repository:

如果您使用Ubuntu 12.04Mint 13,请添加以下存储库:

echo "deb http://repo.mongodb.org/apt/ubuntu precise/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list

If you work with Ubuntu 14.04or Mint 17add the following repository:

如果您使用Ubuntu 14.04Mint 17,请添加以下存储库:

echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list

If you work with Ubuntu 16.04or Mint 18add the following repository:

如果您使用Ubuntu 16.04Mint 18,请添加以下存储库:

echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list

Update the package list and install mongo:

更新包列表并安装 mongo:

sudo apt-get update
sudo apt-get install -y mongodb-org

回答by Muhammad Usman Ali Baloch

sudo apt-get install -y mongodb 

it works for 32-bit ubuntu, try it.best of luck.

它适用于 32 位 ubuntu,试试吧。祝你好运。

回答by julien_c

The currently accepted answer works, but will install an outdated version of Mongo.

当前接受的答案有效,但会安装过时版本的 Mongo。

The Mongo documentation states that: MongoDB only provides packages for Ubuntu 12.04 LTS (Precise Pangolin) and 14.04 LTS (Trusty Tahr). However, These packages may work with other Ubuntu releases.

Mongo 文档指出: MongoDB 仅提供适用于 Ubuntu 12.04 LTS (Precise Pangolin) 和 14.04 LTS (Trusty Tahr) 的软件包。但是,这些软件包可能适用于其他 Ubuntu 版本。

So, to get the lastest stable Mongo (3.0), use this (the different step is the second one):

因此,要获得最新稳定的 Mongo ( 3.0),请使用此方法(不同的步骤是第二步):

    apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
    echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb.list
    apt-get update
    apt-get install mongodb-org

Hope this helps.

希望这可以帮助。



I would like to add that as a previous step, you must check your GNU/Linux Distro Release, which will construct the Repo list url. For me, as I am using this:

我想补充一点,作为上一步,您必须检查您的 GNU/Linux 发行版,这将构建 Repo 列表 url。对我来说,因为我正在使用这个:

DISTRIB_CODENAME=rafaela
DISTRIB_DESCRIPTION="Linux Mint 17.2 Rafaela"
NAME="Ubuntu"
VERSION="14.04.2 LTS, Trusty Tahr"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 14.04.2 LTS"

The original 2nd step:

原来的第2步:

"Create a list file for MongoDB": "echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list"

Didn't workas intended because it generated an incorrect Repo url. Basically, it put the distribution codename "rafaela"within the url repo which doesn't exist. You can check the Repo url at your package manager under Software Sources, Additional Repositories.

没有按预期工作,因为它生成了不正确的 Repo url。基本上,它将分发代号“rafaela”放在不存在的 url 存储库中。您可以在软件包管理器中的软件源、附加存储库下检查 Repo url。

What I did was to browse the site:

我所做的是浏览网站:

http://repo.mongodb.org/apt/ubuntu/dists/

http://repo.mongodb.org/apt/ubuntu/dists/

And I found out that for Ubuntu, "trusty" and "precise" are the only web folders available, not "rafaela".

我发现对于 Ubuntu,“trusty”和“precise”是唯一可用的 Web 文件夹,而不是“rafaela”。

Solution: Open as root the file 'mongodb-org-3.1.list' or 'mongodb.list' and replace "rafaela" or your release version for the corresponding version (for me it was: "trusty"), save the changes and continue with next steps. Also, your package manager can let you change easily the repo url as well.

解决方案:以 root 身份打开文件 'mongodb-org-3.1.list' 或 'mongodb.list' 并将“rafaela”或您的发布版本替换为相应版本(对我来说是:“trusty”),保存更改并继续下一步。此外,您的包管理器也可以让您轻松更改 repo url。

Hope it works for you.! ---

希望这对你有用。!---

回答by Jeff Sloyer

You first need to add the package database and add the PGP key.

您首先需要添加包数据库并添加 PGP 密钥。

Run the following.

运行以下。

#add pgp key
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10

#add package file
echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list

#update package list
sudo apt-get update

#install mongo
sudo apt-get install -y mongodb-org

回答by YLS

I had the same issue in 14.04, but I fixed it by these steps:

我在 14.04 中遇到了同样的问题,但我通过以下步骤修复了它:

  1. sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
  2. echo "deb http://repo.mongodb.org/apt/ubuntu"$(lsb_release -sc)"/mongodb- org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
  3. sudo apt-get update
  4. sudo apt-get install -y mongodb
  1. sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
  2. echo "deb http://repo.mongodb.org/apt/ubuntu"$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | 须藤三通/etc/apt/sources.list.d/mongodb-org-3.0.list
  3. sudo apt-get 更新
  4. sudo apt-get install -y mongodb

It worked like charm :)

它像魅力一样工作:)