mongoDB on Raspberry PiI’ve been looking at noSQL databases in conjunction with Node.js. I have several Raspberry Pis that I have been using as development and test platforms. I have had good success with couchDB but have seen more examples and deployments using mongoDB. MongoDB is clearly developed on Intel processors but has been ported to non-Intel processors with different “endian”. Getting mongoDB to compile and run on a Raspberry Pi has been a challenge — as seen by the dearth of info when Googling. I did run across a couple of useful sites with links and directions on how to compile mongoDB on the R-Pi BUT both had a few problems. I’ve managed to get mongoDB version 2.1.1 working.  Specific instructions —

 

As of 20 July 2014, the below instructions no longer result in a stable version of MongoDB.  Everything seems to compile and install but mongod & mongo do not function correctly.  Check out my new post about mongoDB 2.6.3 on R-Pi

 

As of 16 February 2013:

First ensure your Raspbian OS is up to date with:

sudo apt-get update

sudo apt-get upgrade

uname -a

I see:

>> Linux black-pi 3.6.11+ #371 PREEMPT Thu Feb 7 16:31:35 GMT 2013 armv6l GNU/Linux

Now apt-get dependencies and do build(s).  You need a 512MB RAM R-Pi and this can take about 5 hours!


sudo apt-get install build-essential libboost-filesystem-dev libboost-program-options-dev libboost-system-dev libboost-thread-dev scons libboost-all-dev python-pymongo git

git clone https://github.com/skrabban/mongo-nonx86

cd mongo-nonx86/

scons

sudo scons –prefix=/opt/mongo install

Now add mongodb user and set up required directories with correct permissions

sudo adduser --firstuid 100 --ingroup nogroup --shell /etc/false --disabled-password --gecos "" --no-create-home mongodb

sudo mkdir /var/log/mongodb/

sudo chown mongodb:nogroup /var/log/mongodb/

sudo mkdir /var/lib/mongodb

sudo chown mongodb:nogroup /var/lib/mongodb

sudo cp debian/init.d /etc/init.d/mongod

sudo cp debian/mongodb.conf /etc/

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

The config file for mongoDb is: /etc/mongodb.conf

You can start mongoDB by: sudo /etc/init.d/mongod start

You can stop it with: sudo /etc/init.d/mogod stop

You can get the command line by: /opt/mongo/bin/mongo

References:

Install Mongodb in Raspberry Pi

Building MongoDB on Raspberry Pi