Database Reference
In-Depth Information
To r un M o n go D B , y o u ' ll n e e d a d a t a d ir e c t o r y. B y d e f a ul t , t h e mongod daemon will
store its data files in /data/db . Create that directory, and ensure that it has the proper
permissions:
$ sudo mkdir -p /data/db/
$ sudo chown `id -u` /data/db
You're ready to start the server. Just change to the MongoDB bin directory and launch
the mongod executable:
cd mongodb-linux-x86_64-2.0.0/bin
./mongod
If all goes well, you should see something like the following abridged startup log. Note
the last lines, confirming that the server is listening on the default port of 27017:
Thu Mar 10 11:28:51 [initandlisten] MongoDB starting :
pid=1773 port=27017 dbpath=/data/db/ 64-bit
Thu Mar 10 11:28:51 [initandlisten] db version v2.0.0, pdfile version 4.5
...
Thu Mar 10 11:28:51 [initandlisten] waiting for connections on port 27017
Thu Mar 10 11:28:51 [websvr] web admin interface listening on port 28017
If the server terminates unexpectedly, then refer to section A.5.
U SING A PACKAGE MANAGER
Package managers can greatly simplify the installation of MongoDB. The only major
downside is that package maintainers may not always keep up with the latest MongoDB
releases. It's important to run the latest stable point release, so if you do choose to use
a package manager, be sure that the version you're installing is a recent one.
If you happen to be running Debian, Ubuntu, CentOS, or Fedora, you'll always
have access to the latest versions. This is because 10gen maintains and publishes its
own packages for these platforms. You can find more information on installing these
particular packages on the mongodb.org website. Instructions for Debian and
Ubuntu can be found at http://mng.bz/ZffG . For CentOS and Fedora, see http://
mng.bz/JSjC .
Packages are also available for FreeBSD and ArchLinux. See their respective pack-
age repositories for details.
A.1.2
MongoDB on Mac OS X
There are three ways to install MongoDB on Mac OS X . You can download the pre-
compiled binaries directly from the mongodb.org website, use a package manager, or
compile manually from source. We'll discuss the first two in the next sections, and
then provide a few notes on compiling later in the appendix.
P RECOMPILED BINARIES
First navigate to http://www.mongodb.org/downloads . There you'll see a grid with all
the latest downloadable MongoDB binaries. Select the download URL for the latest
 
Search WWH ::




Custom Search