![MongoDB 4 Quick Start Guide](https://wfqqreader-1252317822.image.myqcloud.com/cover/381/36699381/b_36699381.jpg)
上QQ阅读APP看书,第一时间看更新
Configure and run MongoDB on Ubuntu/Debian
If you followed the procedure outlined in the previous section, a configuration file /etc/mongod.conf will have been auto-generated by the installation script. By default, data files will be placed in /var/lib/mongodb and log files in /var/log/mongodb/mongod.log:
![](https://epubservercos.yuewen.com/845C96/19470388008854906/epubprivate/OEBPS/Images/57da5b41-869b-4484-813d-dd902563f0b1.png?sign=1739317162-ENNelsTIBNoZzWQ60Dkl1iAjKDgqHPtt-0-a95223612dd5e2609a965405c3af6755)
You are now able to perform these operations:
Operation Command
Start | stop | restart the server sudo service mongod start|stop|restart
Get the server status sudo service mongod status
Access MongoDB via the shell (covered later) mongo --host 127.0.0.1:27017
Here you can see the server started, along with its status:
![](https://epubservercos.yuewen.com/845C96/19470388008854906/epubprivate/OEBPS/Images/f0c5f44d-b7c1-4e98-a55c-f274559c021c.png?sign=1739317162-CKbVVs7fxCzbQrVJmD9vAe9PRA0SBvRO-0-7b752d3c079a11cb4cba2593b4f5ecde)
MongoDB installation scripts now automatically bind MongoDB to localhost (IP address 127.0.0.1) for security reasons.