Monthly Archives: February 2014

Installing mongodb on Raspberry Pi (using pre-compiled binaries)

For some time I have been struggling to install mongodb on Raspberry Pi v2 (512mb) by compiling it from source. This guide show you how to download, install and configure a pre-compiled version of mongodb.

I am using Raspbian Debian Wheesy:
Linux <hostname> 3.10.25+ #622 PREEMPT Fri Jan 3 18:41:00 GMT 2014 armv6l GNU/Linux

At first I could not find any suitable pre-compiled binaries around and then tried several tutorials which involved to compile mongodb from source:

However no matter how I did it seemed that the poor Raspberry died or crashed each time I tried to compile the source without any useful errors or explanations. It simple just died. I tried to adjust my overclokcing settings, swap size, free up RAM etc. But still it did not want to work.

After days and hours of struggling with compling the sources I decided to give up and went to search for a pre-compiled version and found one that I got working:

Thank you Brice Morin!


Step-by-step guide

Update system

Run as root or with sudo:

apt-get update
apt-get upgrade

Download mongodb

I have put together a package with the binaries from Brice which you can download here or you can use git to fetch the files directly from his repository.
Download mongodb-rpi_20140207 binaries

Install and configure

Run as root or with sudo:

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

cp -R mongodb-rpi/mongo /opt
chmod +x /opt/mongo/bin/*

mkdir /var/log/mongodb 
chown mongodb:nogroup /var/log/mongodb
mkdir /var/lib/mongodb
chown mongodb:nogroup /var/lib/mongodb

cp mongodb-rpi/debian/init.d /etc/init.d/mongod
cp mongodb-rpi/debian/mongodb.conf /etc/

ln -s /opt/mongo/bin/mongod /usr/bin/mongod
chmod u+x /etc/init.d/mongod

update-rc.d mongod defaults
/etc/init.d/mongod start

Browse to http://localhost:28017/ to see status of mongo db.

Mongod Status