Install MongoDB on Raspberry Pi (Raspbian)

  1. Run sudo apt-cache policy mongodb to determine the version of MongoDB that will be installed
  2. Run sudo apt-get update
  3. Run sudo apt-get install mongodb
  4. Go to /var/lib and check which user mongodb folder was installed as (e.g. mongodb)
  5. In root directory (e.g. cd /) run sudo mkdir -p /data/db (this is the default directory for the mongod process)
  6. In root directory run sudo chgrp -R mongodb data to allow mongodb user to write to the directory
  7. In root directory run sudo chmod -R 775 data to allow groups to write to the directory
  8. Run sudo nano /etc/mongodb.conf
  9. Change bind_ip value to be (instead of so that you can connect to it via localhost and the ip address of the machine
  10. Run sudo reboot to restart the Raspberry Pi
  11. Run service mongodb status to check if mongodb has started
- MongoDB default port is 27017
- To create a user under in version 2.4 then you can run something like:
  { user: "activitiesDBAdmin", 
    pwd: "activitiesDBAdmin", 
    roles: [ "readWrite", "clusterAdmin", "readAnyDatabase", "dbAdmin" ]