Home » Categories » Multiple Categories

How To Install MongoDB on Ubuntu 12.04

Install MongoDB on Ubuntu 12.04

MongoDB is a document database used commonly in modern web applications. This tutorial should help you setup a virtual private server to use as a dedicated MongoDB server for a production application environment.

The MongoDB install process is simple enough to be completed with a Bash script. Copy the following into a new file named `mongo_install.bash` in your home directory:

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

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

apt-get -y update

apt-get -y install mongodb-10gen


Here's an explanation of each line in the script:

  1. The `apt-key` call registers the public key of the custom 10gen MongoDB aptitude repository
  2. A custom 10gen repository list file is created containing the location of the MongoDB binaries
  3. Aptitude is updated so that new packages can be registered locally
  4. Aptitude is told to install MongoDB


TIP: At any time, to change to your home directory, simply execute `cd`

Run the Install Script

Execute the following from your home directory:

$ sudo bash ./mongo_install.bash


If everything is successful, you should see the output contain a PID of the newly started MongoDB process:

mongodb start/running, process 2368

Check It Out

By default with this install method, MongoDB should start automatically when your system is booted. This means that if you need to reboot your system, MongoDB will start right back up.
To start learning about the running `mongod` process, run the following command:

$ ps aux | grep mongo


One line of the output should look like the following:

mongodb 5690.4 6.4 627676 15936 ? Ssl22:54 0:02 /usr/bin/mongod --config /etc/mongodb.conf

 

Attachments Attachments
There are no attachments for this article.
Related Articles RSS Feed
How To Set Up mod_security with Apache on Debian/Ubuntu
Viewed 4198 times since Thu, Dec 26, 2013
How To Install and Use Docker: Getting Started
Viewed 3942 times since Sat, Jan 4, 2014
How To Set Up Apache Virtual Hosts on Ubuntu 12.04 LTS
Viewed 3624 times since Mon, Dec 23, 2013
How To Setup ownCloud 5 On Ubuntu 12.10
Viewed 5846 times since Sat, Jan 4, 2014
How To Install and Configure Django with Postgres, Nginx, and Gunicorn
Viewed 4412 times since Fri, Jan 3, 2014
How To Use Top, Netstat, Du, & Other Tools to Monitor Server Resources
Viewed 6931 times since Sat, Jan 4, 2014
How to Setup Additional Entropy for Cloud Servers Using Haveged
Viewed 2637 times since Sat, Jan 4, 2014
How To Create Nagios Plugins With Bash On Ubuntu 12.10
Viewed 2235 times since Sat, Jan 4, 2014
How To Create Nagios Plugins With PHP On Ubuntu 12.10
Viewed 2445 times since Sat, Jan 4, 2014
Top 10 Linux Easter Eggs
Viewed 7460 times since Sat, Jan 4, 2014