On OSX do the following. Download the latest production release of MongoDB from here:
http://www.mongodb.org/downloads
Then install it in /usr/local using the following commands:
1 2 3 4 |
|
Next you’ll need to create the MongoDB configuration file. First set up the storage location for the MongoDB database files:
echo "dbpath = /usr/local/mongodb_data" > /usr/local/mongodb/mongodb.conf
If you only want it to accept local connections, add this line to the config file:
echo "bind_ip = 127.0.0.1" >> /usr/local/mongodb/mongodb.conf
To get MongoDB to startup & shutdown automagically with OSX, you’ll want to create a launchd entry: /Library/LaunchDaemons/org.mongodb.mongod.plist
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
|
Thats about it. To manually start & stop MongoDB type:
1 2 |
|
On Ubuntu Linux the installation instructions are similar, with a few differences:
Download the latest production release of MongoDB from here: http://www.mongodb.org/downloads
Then install it in /usr/local using the following commands:
1 2 3 4 |
|
Next you’’ll need to create the MongoDB configuration file. First set up the storage location for the MongoDB database files:
echo "dbpath = /usr/local/mongodb_data" > /usr/local/mongodb/mongodb.conf
If you only want it to accept local connections, add this line to the config file:
echo "bind_ip = 127.0.0.1" >> /usr/local/mongodb/mongodb.conf
Next you’ll want to put an entry into /etc/init.d so that it will startup & shutdown with Ubuntu. Download this file, gunzip it, & place it in /etc/init.d. Make sure it has executable permissions: MongoDB.gz
With both OSX and Ubuntu, if you did everything correctly, your MongoDB process can be found running here: http://localhost:28017