How to install MongoDB in Linux

If you want to install MongoDB on your Linux machine you should not use the default package handler. Instead download the tarball from this site. I tried installing MongoDB from my repositories at first, then I found out later that I had to manually install it to get it working with MongoTemplate in Spring. When you install the database, remember to create the folder /data/db on your system. All the dbs you create are stored there:

$ sudo mkdir -p /data/db/
$ sudo chown `id -u` /data/db

Read more about the issue over at StackOverFlow.

Leave a Reply