Ubuntu 15.10安装mongodb

首先按照官方文档:https://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/

sudo service mongod start

在执行启动服务时会报错——

Failed to start mongod.service: Unit mongod.service failed to load: No such file or directory.

解决方法在这里

http://askubuntu.com/questions/690993/mongodb-3-0-2-wont-start-after-upgrading-to-ubuntu-15-10

Create a file /lib/systemd/system/mongod.service with the following content:

[Unit]
Description=High-performance, schema-free document-oriented database
After=network.target

[Service]
User=mongodb
ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf

[Install]
WantedBy=multi-user.target

注意,/etc/mongod.conf是配置文件,原文是mongodb.conf,根据自己的情况修改。

问题原因

在刚才帖子下方有人解释了——

This error occurred due to the problem with the new Ubuntu (15 and ahead).

Default init system is systemd which was Upstart previously.

你可能感兴趣的:(马克部落,mongodb,ubuntu)