Installing MongoDB and Node on Raspberry PI

By July 18, 2015Uncategorized
There are numerous reasons one would want to run node and mongo a pi; a mini web server, home automation control etc.  With the improved specification of the Raspberry PI2, the argument becomes even more compelling.  The are plenty of blog postings about how to install different versions of node and mongo on the raspberry pi, but I have found one combination to be the the best. Rick Ps Mongo Pi and Node Version 0.10.42. The process is a bit more involved than using apt-get but in the end it’s a proven stable combo that works on the pi ( in my opinion ). Here are the instructions

install all the dependancies you will need to build everything
sudo apt-get update
sudo apt-get install git-core git scons build-essential scons libpcre++-dev libboost-dev libboost-program-options-dev libboost-thread-dev libboost-filesystem-dev
tar xvf node-v0.10.28.tar.gz
cd node-v0.10.28
sudo make install
now grab a cup of coffee because this will take a while. Once that is done you can install mongo

git clone git://
cd mongopi
sudo scons –prefix=/opt/mongo install
scons -c

if you though node took a while buckle in, you may want to issue this command before you go out for the day so that it’s done by the time you get back

add mongo to your path directory

PATH=$PATH:/opt/mongo/bin/ export PATH

at this point you have a choice, you can run mongo as root, or create a new user. If you are the only one messing with the pi, just do it as root (pi@raspberripi) if not add a new user

sudo useradd mongodb

sudo mkdir /var/lib/mongodb sudo chown mongodb:mongodb /var/lib/mongodb now set the paths and start mongo

sudo mkdir /etc/mongodb/

sudo sh -c ‘echo “dbpath=/var/lib/mongodb” > /etc/mongodb/mongodb.conf’

cd /etc/init.d sudo wget -O mongodb

sudo chmod +x mongodb sudo update-rc.d mongodb defaults

sudo service mongodb start

boom, your ready to start developing your node app on your raspberry pi