Database Reference
In-Depth Information
Installing MongoDB under Linux
The Unix-based operating systems are extremely popular choices at the moment for
hosting services, including web services, mail services, and, of course, database services.
In this chapter, we'll walk you through how to get MongoDB running on a popular Linux
distribution: Ubuntu.
Depending on your needs, you have two ways of installing MongoDB under Ubuntu:
you can install the packages automatically through so-called repositories , or you can
install it manually. The next two sections will walk you through both options.
Installing MongoDB through the Repositories
Repositories are basically online directories filled with software. Every package contains
information about the version number, prerequisites, and possible incompatibilities.
This information is useful when you need to install a software package that requires
another piece of software to be installed first because the prerequisites can be installed
at the same time.
The default repositories available in Ubuntu (and other Debian-based distributions)
contain MongoDB, but they may be out-of-date versions of the software. Therefore,
let's tell apt-get (the software you use to install software from repositories) to look at a
custom repository. To do this, you need to add the following line to your repository-list
( /etc/apt/sources.list ):
deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen
Next, you need to import MongoDB Inc's public GPG key, used to sign the packages,
ensuring their consistency; you can do so by using the apt-key command:
$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
When that is done, you need to tell apt-get that it contains new repositories; you can
do so using apt-get's update command:
$ sudo apt-get update
This line made aptitude aware of your manually added repository. This means
you can now tell apt-get to install the software itself. You do this by typing the following
command in the shell:
$ sudo apt-get install mongodb-org
This line installs the current stable (production) version from MongoDB. If you
wish to install any other version from MongoDB instead, you need to specify the version
number. For example, to install the current unstable (development) version from
MongoDB, type in the following command instead:
$ sudo apt-get install mongodb-org=2.7.8
 
Search WWH ::




Custom Search