須要手動新建/lib/systemd/system/mongod.service文件,並寫入下面內容:vue
vim /lib/systemd/system/mongod.service
[Unit] Description=High-performance, schema-free document-oriented database After=network.target Documentation=https://docs.mongodb.org/manual [Service] User=mongodb Group=mongodb ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf [Install] WantedBy=multi-user.target
sudo systemctl enable mongod
sudo service mongod start sudo service mongod restart sudo service mongod stop
sudo: unable to resolve host iZ2ze4xswj2tx5xmtq0f5pZ
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package mongodb-orgnode
cat /etc/hostname
把主機名字查出來mongodb
而後添加到vim
vim /etc/hosts
這個文件的localhost 後面 加個空格隔開ui