MongoDB is a free and open source document based DBMS . Use the following command for MongoDB installation:
1) Execute the following command to import the public GPG Key.
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
2) Following command will create a new file "mongodb.list" in /etc/apt/sources.list.d/ folder and will write the MongoDB repository details.
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
3) Update the Packages .
sudo apt-get update
4) Now finally install the MongoDB.
sudo apt-get install mongodb-10gen=2.2.3
5) Now MongoDB is installed to your system. To verify the MongoDB installation execute the following command in shell and it will display the following output.
mongo
Output:
MongoDB shell version: 2.2.3
connecting to: test
Welcome to the MongoDB shell.
Create and display the databases commands:
1) Following command will create a database named nirmala and will switch to that database.
use nirmala
2) Check the current database.
db
3) Following command will display all the databases list.
show dbs
0 Comment(s)