1 Start:
sudo service mongod start
2 Verify that MongoDB has started successfully:
Verify that the mongod
process has started successfully by checking the contents of the log file at/var/log/mongodb/mongod.log
for a line reading
[initandlisten] waiting for connections on port 27017
3 Stop MongoDB
sudo service mongod stop
4 Restart MongoDB
sudo service mongod restart
5 Begin using MongoDB
mongo
详细内容可以参考官方文档https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/