MongoDB packages

Step1: Install the MongoDB packages

CMD: sudo apt-get install -y mongodb-org

Run MongoDB Community Edition

1) Start MongoDB.
Issue the following command to start mongod:

CMD: 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

CMD: [initandlisten] waiting for connections on port 27017
27017 is the default port the standalone mongod listens on.

You may see non-critical warnings in the mongod output. As long as you see the log line shown above, you can safely ignore these warnings during your initial evaluation of MongoDB.

3) Stop MongoDB.
As needed, you can stop the mongod process by issuing the following command:

CMD: sudo service mongod stop

4) Restart MongoDB.
Issue the following command to restart mongod:

CMD: sudo service mongod restart

5) Begin using MongoDB.
Start a mongo shell on the same host machine as the mongod. You can run the mongo shell without any command-line options to connect to a mongod that is running on your localhost with default port 27017:

6) UI for Mongo use (Robo 3T)  (Stadio)

CMD:mongo

More details: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/

Leave a comment