Install MongoDb for Ubuntu 16.04

Ref: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/
https://www.digitalocean.com/community/tutorials/how-to-install-mongodb-on-ubuntu-16-04

Install MongoDB on Ubuntu: 5 Easy Steps

Install GrandNode eCommerce Platform on Ubuntu 16.04 | 18.04 | 18.10

This tutorial installs MongoDB 4.0 Community Edition . For other versions of MongoDB, refer to the corresponding version of the manual.
1. Import the public key used by the package management system.
The Ubuntu package management tools (i.e. dpkg and apt) ensure package consistency and authenticity by requiring that distributors sign packages with GPG keys. Issue the following command to import theMongoDB public GPG Key:

2. Create a list file for MongoDB.
Create the list file /etc/apt/sources.list.d/mongodb-org-4.0.list for your version of Ubuntu.

Click on the appropriate tab for your version of Ubuntu. If you are unsure of what Ubuntu version the host is running, open a terminal or shell on the host and execute lsb_release -dc.

3. Reload local package database.
Issue the following command to reload the local package database:

4. Install the MongoDB packages.
You can install either the latest stable version of MongoDB or a specific version of MongoDB.

Start MongoDb service

Check MongoDb status

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

27017 is the default port the standalone mongod listens on.

Create a database
NOTE: Make sure mongodb already start or start it

then run ‘sudo mongo’:

type in the terminal this script

it will look:

 

Leave a Reply

Your email address will not be published. Required fields are marked *