Setup MongoDB on Linux


Due to there is no a facility for linux, I will post here some steps to do it:
  • Install mongodb
  • Install Pip, virtualenv and virtualenvwrapper
  • Install pymongo and bottle
Install MongoDB
  • sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
  • create this file /etc/apt/sources.list.d/mongodb.list and add this to it
  • sudo apt-get update
  • sudo apt-get install mongodb-org
  • start pymongo service
    • sudo service mongod start
Install pip, virtualenv, virtualenvwrapper
  • sudo apt-get install python-dev python-pip -y
  • sudo pip install virtualenv
  • sudo pip install virtualenvwrapper
  • mkdir ~/.virtualenvs
  • add this lines at the end of your .bashrc file, open it with gedit or vim
    • vim .bashrc
      • export WORKON_HOME=~/.virtualenvs
      • . /usr/local/bin/virtualenvwrapper.sh
    • save and close .bashrc
    • to make it work restart your terminal or run . .bashrc on it
  • create a new virtual enviroment with
    • mkvirtualenv mongodev
  • use the command workon to start your virtualenv
    • e.g workon mongodev
    • to deactivate your virtual env, use the command 'deactivate' :)
Install pymongo and bottle
  • start your virtualenv
    • workon mongodev
    • that will look like (mongodev) home
  • use pip to install pymongo and bottle
    • pip install pymongo
    • pip install bottle
  • to check what you have install in your virtualenv use
    • pip freeze
more info on mongoDB docs
I hope this help you!

Comentarios

Entradas populares de este blog

Git: how to use .gitignore

Backup and restore a postgresql DB

Git: revert pushed commit