Install MongoDB and Python drive __python

Source: Internet
Author: User
Tags install mongodb mongodb

First of all, my system is a ubuntu11.04,64 bit system, the following installation may need to modify their own system conditions.

1. Download MongoDB installation package

$wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.0.0.tgz


2. Decompression

$tar Vzf mongodb-linux-x86_64-2.0.0.tgz

You can also change your name, such as MV Mongodb-linux-x86_64-2.0.0.tgz Mongo2, in order to make it easier to knock orders later.


3. Install Python dependency Pack

According to the official claim, PIP is recommended for installing MongoDB Python drivers, but Pip first relies on setuptools, so you have to check to see if it's installed.

If not, you can download the installation Setuptools or:

$apt-get Install Python-setuptools

Note: If you are using python3.0 or above, please use the corresponding version of Setuptools.

In addition, you may need to install Python-dev in the process of installing the PIP:

$apt-get Install Python-dev


4. Install Pip

First Download:

$wget http://pypi.python.org/packages/source/p/pip/pip-1.0.2.tar.gz#md5=47ec6ff3f6d962696fe08d4c8264ad49

Then unpack:

$tar-XVF pip-1.0.2.tar.gz

Then install:

$CD pip-1.0.2

$python setup.py Install

After you install the PIP, you can use the command to install the Pymongo:


5. Install the Python for MONGO driver

Very simple:

$pip Install Pymongo

Note that the Pymongo can be updated directly through the PIP, and the command is

$pip--upgrade Pymongo


6. Start the MONGO service and connect

First we set up a database storage directory for MONGO, default is/data/db, so if you do not have this directory, you have to use sudo mkdir/data/db to create;

Of course, if you do not want to use the default database directory, you can also specify when starting the MONGO service.

The next step is to start the service:

$./mongod--dbpath=/data/db

Note that first you need to enter the directory where Mongod is located (for example, my directory is/data/mongo2/bin/mongod), and then/data/db can be replaced by the directory you want to specify.

Finally, you can connect to the database in another separate window:

$./mongo


7. After the above steps are completed, you can start writing scripts with Py to manipulate the MONGO.

Python can be written in reference to the previous log:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.