Installing MongoDB on YDL

MongoDB is a pretty good Document Database. It is NOT a Object Database. Anyway. If you want learn more about MongoDB check out this site: http://www.mongodb.org

As far as I know MongoDB is not available over the yum package manager from Yellow Dog Linux (YDL). But it is pretty easy to install. Just download the linux binaries and unpack it.

cd /opt/
sudo wget http://downloads.mongodb.org/linux/mongodb-linux-x86_64-1.8.1.tgz
sudo tar -xzf mongodb-linux-x86_64-1.8.1.tgz

For convenient reasons you can create a short symlink

sudo ln -s mongodb-linux-x86_64-1.8.1 mongodb

Now you can start all mongo binaries under “/opt/mongodb/bin”. For convenient reasons you can create more symlinks.

cd /usr/bin
sudo ln -s /opt/mongodb/bin/mongod
sudo ln -s /opt/mongodb/bin/mongo

MongoDB will save all the database stuff in the directory “/data/db”. If this directory does not exist you will get an error. Just create the directory.

sudo mkdir /data
sudo mkdir /data/db

Now you can start the MongoDB server

sudo mongod

Your MongoDB Server is up and running. In a diffrent shell you can use the mongo client to connect to the server.

mongo

Now you are in the Mongo Shell. By default the mongo client connects to the database “test”. Try this:

db.foo.save({"b":"2"})
db.foo.find()

Now you should see something like this:

{ "_id" : ObjectId("4dd975e60994b04312264239"), "b" : "2" }

Congratulation! You can exit the shell with this command:

exit

Published by Robert Reiz

CEO @ VersionEye. Passionated software developer since 1998.

One thought on “Installing MongoDB on YDL

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: