Tags

,

1. Import the public key used by the package management system

$ sudo apt-key adv –keyserver hkp://keyserver.ubuntu.com:80 –recv 7F0CEB10

2. Create a list file for MongoDB version 3.

$ echo “deb http://repo.mongodb.org/apt/ubuntu “$(lsb_release -sc)”/mongodb-org/3.0 multiverse” | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list

3. Refresh the local database with the packages

$ sudo apt-get update

4. Install the last stable MongoDB version and all the necessary packages on our system

$ sudo apt-get install -y mongodb-org
If you encountered an error “Unable to locate package mongodb-org” then change mongodb-org to mongodb. So, it will now become $ sudo apt-get install -y mongodb

5. Start the mongodb

$ sudo service mongod start ## Other commands: sudo service mongodb start|stop|status
$ mongo
> show databases

References: http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/

Advertisements