在 Ubuntu 16.04 上安装 MongoDB [英] Installing MongoDB on Ubuntu 16.04
问题描述
我正在使用 本官方指南 在我的 Ubuntu 16.04 (Xenial Xerus) 上安装 MongoDB.在 Run MongoDB Community Edition
我得到了
I'm using this official guide to install MongoDB on my Ubuntu 16.04 (Xenial Xerus). At Run MongoDB Community Edition
I got
启动 mongod.service 失败:未找到单元 mongod.service.
Failed to start mongod.service: Unit mongod.service not found.
输入sudo service mongod start
后.我刚刚查看了 /var/log/mongodb
,它是空的.在出现此问题之前,我没有任何其他错误.我该如何解决这个问题?
After typing sudo service mongod start
. I just looked into /var/log/mongodb
, and it's empty. I didn't have any other error before this problem. How can I fix this?
推荐答案
更新检查 这里.
在 Ubuntu 16.04 上安装 MongoDB 社区版的步骤
在终端中运行这些命令(Ctrl + Alt + T):
Run these commands in Terminal (Ctrl + Alt + T):
删除已安装的 MongoDB
To remove an already installed MongoDB
sudo apt-get purge mongodb-org*
sudo rm -r/var/log/mongodbsudo rm -r/var/lib/mongodb
然后使用以下命令开始安装:
Then start installing with the following commands:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse" |须藤三通/etc/apt/sources.list.d/mongodb-org-3.4.list
sudo apt-get update
sudo apt-get install -y mongodb-org
要启动 MongoDB 运行:
To start MongoDB run:
sudo service mongod start
这篇关于在 Ubuntu 16.04 上安装 MongoDB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!