Ubuntu16.04下安装mongodb运行失败解决

原答案:<https://askubuntu.com/questions/770054/mongodb-3-2-doesnt-start-on-lubuntu-16-04-lts-as-a-service/770133#770133

亲测有效,2018.7.25

  1. 创建mongodb.service文件:sudo nano /etc/systemd/system/mongodb.service

  2. 写入如下内容:

[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

  1. 现在可以启动服务并检查它的状态:
sudo systemctl start mongodb
sudo systemctl status mongodb
  1. 使其永久有效
sudo systemctl enable mongodb
posted @ 2018-07-25 19:44  WY~记录  阅读(399)  评论(0编辑  收藏  举报