Database Reference
In-Depth Information
stable version for your architecture. The following example uses MongoDB v2.0 com-
piled for a 64-bit system.
Download the archive using your web browser or the curl utility. Then expand the
archive using tar :
$ curl http://downloads.mongodb.org/osx/mongodb-osx-x86_64-2.0.0.tgz >
mongo.tgz
$ tar xzf mongo.tgz
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 . Go ahead and create that directory:
$ mkdir -p /data/db/
You're now ready to start the server. Just change to the MongoDB bin directory and
launch the mongod executable:
$ cd mongodb-osx-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.
MacPorts ( http://www.macports.org ) and Homebrew ( http://mxcl.github.com/
homebrew/ ) are two package managers for Mac OS X known to maintain up-to-date
versions of MongoDB. To install via MacPorts, run the following:
sudo port install mongodb
Note that MacPorts will build MongoDB and all its dependencies from scratch. If you
go this route, be prepared for a lengthy compile.
Homebrew, rather than compiling, merely downloads the latest binaries, so it's
much faster than MacPorts. You can install MongoDB through Homebrew as follows:
$ brew update
$ brew install mongodb
After installing, Homebrew will provide instructions on how to start MongoDB using
the Mac OS X launch agent.
Search WWH ::




Custom Search