Source: https://andyfelong.com/2016/01/mongodb-3-0-9-binaries-for-raspberry-pi-2-jessie/

Zipped files: https://andyfelong.com/2017/08/mongodb-3-0-14-for-raspbian-stretch/

I’ve received feedback that some folks are having problems compiling MongoDB 3.0.7 per my instructions AND it takes a long time 

MongoDB 3.0.9 just became available but needs quite a few changes to source in order to compile on the Raspberry Pi.  I worked through MongoDB build scripts for ARCH ARM Linux and managed to “translate” for Raspbian (Jessie) Linux on the R-Pi 2.  Rather than creating patch files and writing instructions for building from source, I am providing my compiled binaries.  PLEASE do not post links to my binaries!  Feel free to download for personal use from this site.

[NOTE: I have compiled version 3.0.14 and created binaries for Raspbian Jessie for the R-Pi 2 & 3. NEW: I have also created 3.0.14 binaries for the R-Pi 3 running Raspbian Stretch that will also work on the new R-Pi 3B+.  I have confirmed that the instructions in this blog entry work with the new binaries.]

As always make sure you have updated your R-Pi

sudo apt-get update
sudo apt-get upgrade

You can download a gzip file of the MongoDB core binaries v3.0.9 from here.

md5sum:  aebd9f083ca7c56e7e4d61e205d7d379  core_mongodb.tar.gz

contains:

  • mongo
  • mongod
  • mongoperf
  • mongos

You can download a gzip file of the MongoDB tools v3.0.9 from here.

md5sum:  ec7774fb1f38a601967961ce5defd417  tools_mongodb.tar.gz

contains:

  • mongoexport
  • mongoimport
  • mongorestore
  • mongotop
  • mongodump
  • mongofiles
  • mongooplog
  • mongostat

UPDATE: (31 Jul 2016) I was asked about supporting the SSL option in the tools.  I have compiled tools v3.0.9 with the SSL flag.  You can download a zipped directory from here.

md5sum:  325f070f0337ad7fa0ef3d49bad91b69  mongodb_tools_ssl_3_0_9.tar.gz

UPDATE (18 Mar 2017) You can find MongoDB 3.0.14 binaries in this post

QUICK SETUP INSTRUCTIONS:

These instructions are for base mongodb (mongo, mongod, mongos, mongoperf).  I have recreated from my history file and memory — so you should review carefully — and LMK if you have any issues

– check for mongodb user

grep mongodb /etc/passwd

– if NO mongodb user, create:

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

– cd to the directory with mongo, mongod, mongos, etc
– ensure appropriate owner & executable permissions
– strip out symbols to reduce file size
– move to /usr/bin which is in PATH

cd dir-with-binaries
sudo chown root:root mongo*
sudo chmod 755 mongo*
sudo strip mongo*
sudo cp -p mongo* /usr/bin

– create log file directory with appropriate owner & permissions

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

– create the DB data directory with convenient access perms

sudo mkdir /var/lib/mongodb
sudo chown mongodb:root /var/lib/mongodb
sudo chmod 775 /var/lib/mongodb

– create the mongodb.conf file in /etc

cd /etc
sudo vi mongodb.conf

– insert into file:

# /etc/mongodb.conf
# minimal config file (old style)
# Run mongod --help to see a list of options

bind_ip = 127.0.0.1
quiet = true
dbpath = /var/lib/mongodb
logpath = /var/log/mongodb/mongod.log
logappend = true
storageEngine = mmapv1

– create systemd / service entry

cd /lib/systemd/system
sudo vi mongodb.service

– insert into file:

[Unit]
Description=High-performance, schema-free document-oriented database
After=network.target

[Service]
User=mongodb
ExecStart=/usr/bin/mongod --quiet --config /etc/mongodb.conf

[Install]
WantedBy=multi-user.target

– you are now ready to launch mongodb!

sudo service mongodb start

UPDATE NOTE from Thomas [Thanks!] about latest Raspbian images lacking a needed SSL library!

If you see error status code = 127

This is a libssl1.0.0 error, so you need to reinstall this library to do it:

sudo wget http://ftp.nl.debian.org/debian/pool/main/o/openssl/libssl1.0.0_1.0.1e-2%2Bdeb7u20_armhf.deb
sudo dpkg -i libssl1.0.0_1.0.1e-2+deb7u20_armhf.deb

then run this command:

/usr/bin/mongod –version

You should see both a DB version (3.0.9) and Git version.  If so, you are ready to go...

– check status

sudo service mongodb status

– MAKE SURE YOU SHUTDOWN CLEANLY!

sudo service mongodb stop

Please LMK if you have issues and/or success in using these binaries  and instructions 

MongoDB Tools install:

unzip the tools tar file after downloading into an empty directory (download link described above).  Strip out symbols to reduce size, change owner and permissions, and move to /usr/bin directory:

tar zxvf tools_mongodb.tar.gz
sudo strip mongo*
sudo chown root:root mongo*
sudo chmod 755 mongo*
sudo mv mongo* /usr/bin

You can now invoke tools from the command line — mongodump, mongoimport, etc.