我最近升级到 Ubuntu 15.10,之后 MongoDB 3.0.2 没有启动。
$ sudo service mongod start
这会抛出错误:
Failed to start mongod.service: Unit mongod.service failed to load: No such file or directory.
小智 21
只是缺少 systemd 的服务文件。无需像 Kartik 那样回到新贵,也无需使用与https://docs.mongodb.org/manual/installation/ 中描述的不同的存储库。
创建一个/lib/systemd/system/mongodb.service
包含以下内容的文件:
[Unit]
Description=High-performance, schema-free document-oriented database
After=network.target
[Service]
User=mongodb
ExecStart=/usr/bin/mongod --quiet --config /etc/mongodb.conf
[Install]
WantedBy=multi-user.target
Run Code Online (Sandbox Code Playgroud)
Kar*_*tik 12
出现此错误是由于新 Ubuntu(15 及更早版本)的问题。
默认的 init 系统是systemd,它以前是Upstart。因此,您需要安装 Upstart,重新启动系统,然后就可以运行 mongodb 服务了。
sudo apt-get install upstart-sysv
sudo service mongod start
mongod start/running, process 3371
小智 5
我在 ubuntu 15.10 中使用了 debian 包
echo "deb http://repo.mongodb.org/apt/debian wheezy/mongodb-org/3.0 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
sudo apt-get update
sudo apt-get install -y mongodb-org
Run Code Online (Sandbox Code Playgroud)