MongoDB installation in Windows and Linux

Source: Internet
Author: User
Tags mongodb client mongodb server

1. first to the official website ( http://www.mongodb.org/downloads Download the appropriate installation package, the current version is 2.6
zip and msi format, recommended here to download zip format ,msi C:\PROGRAM FILES\MONGODB 2.6 STANDARD  directory , According to your system selection 32 bit or 64

win8 system 64 bit, download 64 bit zip package, unzip to after download is complete d:\mongodb directory

To create the database directory D:\MongoDB\data, then open the Command Line window and switch to the D:\MongoDB\bin directory to execute the following command:

Mongod--dbpath D:\MongoDB\data

This is a command-line window that prints some startup information, and the last line displays the following information to indicate that the boot was successful.

the-Geneva-23t10: -:48.391+0800[Initandlisten] Waiting forConnections on Port27017

This is in the browser input http://localhost:27017/ you can see the display information as

It looks like you is trying to access MongoDB over HTTP on the native driver port.
Specific as follows:

To this MongoDB is installed, than imagined simple too Doha

To make MongoDB a Windows service:

will be MongoDB installed as Windows The service is very simple and only needs to be added after the command line executed above --install can be

Mongod--dbpath D:\MongoDB\data--install

According to the normal plot, the service should be installed successfully, but unfortunately, the following prompt appears

--install have to is used with--logpath

lo gs directory, so we create log Span style= "Color:rgb (51,51,51);" >s directory D:\MONGODB\LOGS  Span style= "font-family: ' The song Body '; > and then re-execute the command

650) this.width=650; "Src=" http://img.blog.csdn.net/20150819231710876?watermark/2/text/ Ahr0cdovl2jsb2cuy3nkbi5uzxqv/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity/center "Style=" Border:none; "/>

Then put the MongoDB bin to the environment variable to take (the environment variable can be added to see http://blog.chinaunix.net/uid-25810793-id-3257898.html)

With the new CMD, execute the following command:

MOngo into the database.

Show DBS;

Next entry if input MOngo cannot be turned on


Mongod--dbpath D:\MongoDB\data--logpath D:\MongoDB\logs\MongoDB.log--install--servicename MongoDB

Re-enter MOngo to open the


2. MongoDB installation in Linux

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

(Address: http://download.csdn.net/detail/u011575570/9055565)

1. Installation Preparation

Move MongoDB to the /usr/local/mongdb folder

MV Mongodb-linux-i686-1.8.2/usr/local/mongodb

Creating database folders and log files

Mkdir/usr/local/mongodb/data

Touch/usr/local/mongodb/logs

2. set up boot from boot

Add MongoDB Startup Project to Rc.local to ensure MongoDB starts when the server is powered on

echo "/usr/local/mongodb/bin/mongod--dbpath=/usr/local/mongodb/data-–logpath=/usr/local/mongodb/logs--logappend --auth–port=27017 ">>/etc/rc.local

4. start the MongoDB server

CD to the bin folder under the MongoDB directory to start MongoDB

/usr/local/mongodb/bin/mongod--dbpath=/usr/local/mongodb/data--logpath=/usr/local/mongodb/logs--logappend-- port=27017--fork

5. access the database interface (start MongoDB client)

Span style= "Font-family:arial;font-size:14px;line-height:26px;background-color:rgb (255,255,255);" >mongodb The folder, execute command ./mongo

Run as follows:

[Email protected] mongodb]#./bin/mongo

MongoDB Shell version:1.8.2

Connecting To:test

>show DBS


MongoDB installation in Windows and Linux

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.