参考:http://club.verimake.com/topics/36
参考:http://stackoverflow.com/questions/37014186/running-mongodb-on-ubuntu-16-04-lts
关于MongoDB报错: Failed to start mongod.service: Unit mongodb.service is masked,可按照以下步骤解决:
打开以下文件:
sudo vim /etc/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/mongod.conf
[Install]
WantedBy=multi-user.target
执行以下命令:
sudo systemctl enable mongod.service
sudo systemctl daemon-reload
sudo service mongod start