Install mongodb on ubuntu
Hi friends,
Today I am going to give you a step-by-step guide of how to install mongodb on ubuntu server. The steps are:
-
First we need to import the mongodb public GPG key to verify the authenticity of distributor for ubuntu package manager
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
#output would be something like
gpg: requesting key 7F0CEB10 from hkp server keyserver.ubuntu.com
gpg: key 7F0CEB10: public key "Richard Kreuter " imported
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
-
Now we will create a list file for mongodb by using the following command.
echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
#output
deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.0 multiverse
- In this step we will reload the local packages on ubuntu:
sudo apt-get update
-
Once we reached here, we will hit the final command to install the mongodb
sudo apt-get install -y mongodb-org
#To install a specific version you can mention the version
sudo apt-get install -y mongodb-org=3.0.7 mongodb-org-server=3.0.7 mongodb-org-shell=3.0.7 mongodb-org-mongos=3.0.7 mongodb-org-tools=3.0.7
-
Thus mongodb installation is complete. You can check it by simply writing mongo and hitting it. you will be connected to the mongo shell. You can also check the version by:
mongo --version
#output
MongoDB shell version: 3.0.7
Hope you liked this blog and it proved helpful for you. To check more like this please click here.
0 Comment(s)