须要手动新建/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