我正在使用16.04.1-Ubuntu SMP i686 athlon i686 GNU / Linux(LINUX Mint)
我遵循了[官方文档] [1],但最终出现错误。
使用最新版本的MongoDB安装
$ sudo apt-get install -y mongodb-org
错误
Package mongodb-org is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'mongodb-org' has no installation candidate
使用Mongodb的特定版本进行安装
$sudo apt-get install -y mongodb-org=4.0.4 mongodb-org-server=4.0.4 mongodb-org-shell=4.0.4 mongodb-org-mongos=4.0.4 mongodb-org-tools=4.0.4
错误
E: Version '4.0.4' for 'mongodb-org' was not found
E: Version '4.0.4' for 'mongodb-org-server' was not found
E: Version '4.0.4' for 'mongodb-org-shell' was not found
E: Version '4.0.4' for 'mongodb-org-mongos' was not found
E: Version '4.0.4' for 'mongodb-org-tools' was not found
注意:以上安装是在执行这些代码之后完成的
$sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4
$echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list
$sudo apt-get update
答案 0 :(得分:0)
教程:https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/
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
sudo service mongod start
答案 1 :(得分:0)
$sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4
$echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list
$sudo apt-get update
请注意,.list文件中有ubuntu trusty
,但您声明自己正在运行Ubuntu 16.04
。安装文档包含用于受支持的Ubuntu版本的选项卡。例如,单击Ubuntu 16.04的选项卡可提供以下信息:
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
您可能需要删除旧的.list
文件并从头开始以删除任何潜在的冲突。 sudo rm /etc/apt/sources.list.d/mongodb-org-4.0.list
。
然后重复安装步骤,确保为您的Ubuntu版本选择正确的选项卡。您可以cat /etc/apt/sources.list.d/mongodb-org-4.0.list
仔细检查所有匹配项。
上周,我已经在VM中的Ubuntu 16.04上验证了我们的安装说明,因此我们应该能够在这里启动并运行。
答案 2 :(得分:0)
您声明:
I am using 16.04.1-Ubuntu SMP i686 athlon **i686** GNU/Linux (LINUX Mint)
您的系统为 32位。
但是,您正在尝试安装 amd64(64位)源/软件包:
$echo "deb [ **arch=amd64** ] https://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list
这行不通。
解决方案:安装Ubuntu 64位。