ScaleScaleScaleScale

Tips / Nginx


How to Install MongoDB on Ubuntu 12.04

MongoDB is a document database used by the most modern web applications. It’s also the leading NoSQL database at this time. This how to will help you to install MongoDB server on Ubuntu 12.04 for a production server/website. Let’start!

Import the necessary key

apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10

Add the mongodb repo to your system’s repo

echo "deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen" | tee -a /etc/apt/sources.list.d/10gen.list

Update your repository information and install

apt-get -y update
apt-get -y install mongodb-10gen

Start your service

service mongodb start

This should be he output example:

root@server:~# service mongodb start
mongodb start/running, process 5593

Check if it is really working

ps -aux | grep mongodb

You should see something like this:

root@server:~# ps -aux | grep mongodb
mongodb 5593 0.4 3.8 348172 38596 ? Ssl 08:23 0:00 /usr/bin/mongod --config /etc/mongodb.conf

How can I start using MongoDB?

Start working with the shell to test basic commands, type:

mongo

You should see something like this:

MongoDB shell version: 2.4.9
connecting to: test
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
http://docs.mongodb.org/
Questions? Try the support group
http://groups.google.com/group/mongodb-user
>

At this point you should have MongoDB installed on Ubuntu 12.04.

Need to read more? Visit the official MongoDB webiste.

profile

Esteban Borges

Linux Geek, Webperf Addict, Nginx Fan. CTO @Infranetworking