Recently, I want to install MongoDB in my Rasp Pi. But unfortunately, I can’t install MongoDB via apt-get because Rasp Pi is using ARM architecture.
Maybe we can compile it from source code. Yes. We can. But MongoDB source is very x86 specific, meaning the newest version isn’t available for ARM architecture.
But… Thanks to this owsem patches from Per Ola Ingvarsson on Github at https://github.com/skrabban/mongo-nonx86, now we can compile MongoDB on Rasp Pi. Yeay!
So, to build MongoDB on your RaspberryPi:
Install the required packages:
sudo apt-get install git-core build-essential scons libpcre++-dev xulrunner-dev libboost-dev libboost-program-options-dev libboost-thread-dev libboost-filesystem-dev
Clone the Github repo:
git clone https://github.com/skrabban/mongo-nonx86
Now let’s compile it! (*Note that these two steps take a very very long time on a Rasp Pi. So I left mine for 1 day for this.)
cd mongo-nonx86 scons sudo scons --prefix=/opt/mongo install
Done! You have MongoDB installed on your Rasp Pi.
This will install mongo in /opt/mongo, to get other programs to see it, you can add this dir to your $PATH:
PATH=$PATH:/opt/mongo/bin/ export PATH