how to install mongodb in ubuntu

MongoDB is a non-relational data store of JSON documents. What I mean by non-relational is that it does not store data in tables as these relational databases do. It stores the JSON document

 For more information about 4.0 version of MongoDB click here 

Step 1 – Add GPG Key

Import the GPG key to the mango appropriate repository on your ubuntu system using the command below. This is required before installation.

$ sudo apt-key adv --keyserver hkp: //keyserver.ubuntu.com: 80-recv 68818C72E52529D4.

 

Create APT repository /etc/apt/source.list.d/  with this command :

Step 2 – Create Source List File Mongo

$ sudo echo "deb http://repo.mongodb.org/apt/ubuntu bionic / mongolod-org / 4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list

 

Step 3 – Update the repository

Update the repository using this command:

$ sudo apt-get update

 

Step 4 – Install Mongo on Ubuntu

After adding the required APT repository you can now install Mongo  by typing this command :

$ sudo apt-get install -y mongodb-org

 

Step 5 – Manage Mango Services

Start or stop Mongo using this command and add it as a service to be started at boot time:

$ sudo systemctl mongod enable 
$ sudo systemctl start mengo 
$ sudo systemctl stop mengod 
$ sudo systemctl restart mongod

 

Now you can see that Porto has been started on 27017 using the below command:

$ sudo netstat - tulnp

 

Step 6 – Verify Mango

Now you can check the MongoDB version  in your system using the following command :

$ mongod --version

 

Enjoyed all 🙂

Also Read:  How to Install Laravel

 

Leave a Reply

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