MongoDB M101P Windows 8.1 64bit Installation

This document walks you through installing the tools and libraries needed for the MongoDB M101P course available through university.mongodb.com

Installing MongoDB

Go to www.mongodb.org/downloads
image
Click on the huge green button to download MongoDB in a MSI file.
(The current version is 3.0.1)
”Unblock” the downloaded MSI by, right clicking on the file and choosing properties.  Then hit the unblock button.   Then hit Apply, then OK. If you don’t have this that’s okay.  Continue on.

image

Run the downloaded MSI file – you’ll likely have to approve installation 
I prefer to choose to do a custom install to C:\mongodb
After you have finished installing, you should now have C:\mongodb
With a subfolder C:\mongodb\bin
Create a folder C:\data
Create a subfolder C:\data\db

Installing Python

Go to the Python download page: www.python.org/download
clip_image002
clip_image003
Choose the Python 2.7.9 X86-64 installer.  Download and install it.  Let it go with the default path of C:\Python27
As of this publication date, the course content is not compatible with Python 3.x.  So, don’t get it!

Setting your path

If you want to be able to easily run the Python and MongoDB binaries from the command line you need to set your system path.
clip_image004
Choose System
clip_image005
Choose Advanced System Settings.  Then choose Environment Variables button.
clip_image006
clip_image007
Select the System Variables path as shown above.  Then click edit.  Append this to your system path:
;C:\Python27;C:\Python27\Scripts;C:\mongodb\bin; 
Don’t miss the leading and trailing semi-colons. 

Installing PIP

Go to http://www.pip-installer.org/en/latest/installing.html
Download get-pip.py I did this by, right clicking on the link and choosing, save link as
Next, open a cmd prompt.  You can do this with  <windows> + <r>  then typing cmd <enter>

Change to the directory where you downloaded get-pip.py, most likely C:\users\yourName\Downloads, and run it:
python get-pip.py
clip_image008

Installing pymongo

Visit https://pypi.python.org/pypi/pymongo/#downloads
clip_image009
Download and run the win-amd64 EXE and run it.  The current version is pymongo-2.7.2 (pymongo-2.7.2.win-amd64-py2.7.exe).  The installer will be blue background with white text and will have a title similar to the following:
clip_image010
After installation, run pip list to see that pymongo is installed (should be the new version).
clip_image011

Installing bottle

Use pip to install bottle.  Note that we have to use a special option to specify the version of bottle that we want installed.
pip install bottle==0.11.6
clip_image012

Project folder

Create yourself a project folder such as C:\Projects\m101p

I recommend that you create a subfolder for every weeks course files.  So, for the first week you would have C:\Projects\m101p\week1

Do not put course files in either the mongodb or python27 installation folders.

Starting MongoDB

I also suggest that you see this gist: https://gist.github.com/k0emt/10342867 as a way to start up a development mongod instance.

Stopping MongoDB

Use the mongo shell to properly shutdown mongod. Issue the following commands:

use admin

db.serverShutdown()

image

Subsequent to issuing the commands you will see some error messages.   This is normal as the shell just lost connection with the server.  You can now use <ctrl> + <d> or type the word exit to quit the shell.

9 comments:

  1. Hi,
    Thanks for the steps for installation.

    I am getting an Error at step Installing PIP :
    "Cannot fetch index base URL https://pypi.python.org/simple/
    Could not find any downloads that satisfy the requirement pip"


    Please extend your help.

    Thanks,
    Akshay

    ReplyDelete
  2. So, there are a couple of potential issues/resolutions. The site could have been unavailable. Have you tried again? Are you behind a proxy?

    ReplyDelete
  3. Hi,

    The site is accessible to me.
    But in log file as well it says its unable to access the site.

    And,yes I am on a secured network.

    Is there a workaround to this.Else do we have an option of going ahead without getting pip installed?
    I see pip is required just to install bottle.

    Thanks,
    Akshay Kashyap

    ReplyDelete
    Replies
    1. You can go to this website: https://pypi.python.org/pypi/bottle/0.11.6 and pull the .tar.gz file down: bottle-0.11.6.tar.gz You will likely need a program like 7-Zip to open the .tar.gz. http://www.7-zip.org/ Open the file up and drill down to find the file bottle.py. You can put the bottle.py file in your working directory or copy it into your Python Lib directory.

      Delete
  4. The software versions and course are being updated to MongoDB v2.6.0 and PyMongo v2.7.0. Make sure to use those versions now.

    ReplyDelete
  5. Thanks for the installation steps. I installed Python and then pip and then pimongo. Installation was successful, but when I type pip list in the cmd prompt,it tells pip is not recognized as an internal or external command. I can see PIP folder in C:\Python27\Lib\site-packages also. Pls help

    ReplyDelete
  6. Did you set your path? Did you close any existing command prompt windows? The path will only take effect for command windows opened after it is configured.

    ReplyDelete
  7. Hi Bryan
    when I try to run mongo < create_student_collection.js The promp show that '<' is reserved for future uses. Do you know how to run mongo < preperly?
    Thanks and good blog!

    ReplyDelete
    Replies
    1. You need to use the DOS cmd.exe shell and not the power shell.

      Delete