我最近安装了Ubuntu 18.04 LTS版本,并且刚刚开始学习使用Linux和终端。我想安装mongodb。我正在按照this网站上的步骤进行操作。
我在终端中运行了以下几行
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
运行第四行后,将出现以下内容
tasif@Tasif-Dell:/$ sudo apt-get install -y mongodb-org
[sudo] password for tasif:
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.
然后,当我要启动mongodb时,将显示以下消息
tasif@Tasif-Dell:/$ sudo service mongod start
[sudo] password for tasif:
Failed to start mongod.service: Unit mongod.service not found.
答案 0 :(得分:4)
安装libcurl3为我修复了该问题
sudo apt install libcurl3
答案 1 :(得分:1)
不幸的是,还没有针对18.04的MongoDB的非开发版本。 (截至2018年7月12日)
https://repo.mongodb.org/apt/ubuntu/dists/bionic/显示只有一个开发版本。
您的特定问题是您没有安装Mongo的所有依赖项,可以通过以下方式解决此问题:
sudo apt-get install -f