This article covers a version of Ubuntu that is no longer supported. If you are currently operate a server running Ubuntu 12.04, we highly recommend upgrading or migrating to a supported version of Ubuntu:
Reason: Ubuntu 12.04 reached end of life (EOL) on April 28, 2017 and no longer receives security patches or updates. This guide is no longer maintained.
This guide might still be useful as a reference, but may not work on other Ubuntu releases. If available, we strongly recommend using a guide written for the version of Ubuntu you are using. You can use the search functionality at the top of the page to find a more recent version.
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.
This one's easy. Once you're done, go ahead and `ssh` in.
N.B. :: It is recommended that you configure `ssh` and `sudo` like this
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:
TIP: At any time, to change to your home directory, simply execute `cd`
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
By default with this install method, MongoDB should start automatically when your Droplet is booted. This means that if you need to reboot your Droplet, 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 569 0.4 6.4 627676 15936 ? Ssl 22:54 0:02 /usr/bin/mongod --config /etc/mongodb.confWe can see the...
Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.