How to start the MongoDB server on the system start
Jump to navigation
Jump to search
How to start the MongoDB server on the system start
Step -1
First, open the terminal then login to the required server
Gives the below commands
systemctl enable mongodb.service
Step -2
If you install MongoDB using the Advanced Packaging Tool (apt) then it'll configure your startup scripts to automatically run Mongo when the system boots.
These steps are following too, first configure apt to be able to download the Mongo package:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10 vi /etc/apt/sources.list
Step -3
Add this line to sources.list then save the files
deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen
Step -4
Then download and install Mongo with the apt-get utility:
sudo apt-get update sudo apt-get upgrade sudo apt-get install mongodb-10gen
Step -5
If you want to make any changes to the config, edit your mongodb.conf and restart
vi /etc/mongodb.conf sudo service mongod restart