MongoDB2.4.3 installation in Ubuntu13.04

Source: Internet
Author: User
Tags install mongodb mongodb version
MongoDB2.4.3 installation in Ubuntu13.04 I. Requirement MongoDB version: 2.4.3Ubuntu version: 13.04 II. Note that 10gen provides the MongoDB. deb package version, which makes it easy to install in ubuntu. Although Ubuntu also provides a MongoDB package, the MongoDB version managed by its package is a little old and cannot be installed with the latest version. Therefore

MongoDB 2.4.3 installation in Ubuntu13.04 I. MongoDB version: 2.4.3 Ubuntu version: 13.04 II. Note that 10gen provides the MongoDB. deb package version, which makes it easy to install in ubuntu. Although Ubuntu also provides a MongoDB package, the MongoDB version managed by its package is a little old and cannot be installed with the latest version. Therefore

MongoDB2.4.3 installation in Ubuntu13.04

I. Requirements

MongoDB version: 2.4.3

Ubuntu version: 13.04

Ii. Description

10gen provides MongoDB's. deb package version, making it easy to install on ubuntu. Although Ubuntu also provides a MongoDB package, the MongoDB version managed by its package is a little old and cannot be installed with the latest version. Therefore, the latest version must be installed on the official website.

10gen provides a mongodb-10gen package that includes the latest MongoDB stable version and also provides the mongodb-clients package.

Iii. Installation

1. Configure the package management system

Ubuntu's package management tools (such as dpkg or apt) Ensure package consistency and authorization.

$ Sudo apt-key adv -- keyserver keyserver.ubuntu.com -- recv 7F0CEB10

[Sudo] password for chszs:

Executing: gpg -- ignore-time-conflict -- no-options -- no-default-keyring -- secret-keyring/tmp. tpL2Sensb5 -- trustdb-name/etc/apt // trustdb. gpg -- keyring/etc/apt/trusted. gpg -- primary-keyring/etc/apt/trusted. gpg -- keyserver keyserver.ubuntu.com -- recv 7F0CEB10

Gpg: Download the secret '7f0ceb10' from hkp server keyserver.ubuntu.com

Gpg: Key 7F0CEB10: Public Key "Richard Kreuter "Imported

Gpg: no key absolutely trusted

Gpg: Total number of processed items: 1

Gpg: imported: 1 (RSA: 1)

Create the/etc/apt/sources. list. d/10gen. list file, which contains the following content:

$ Echo 'Destroy http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen '| sudo tee/etc/apt/sources. list. d/10gen. list

Deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen

Use the following command to update the software library:

$ Sudo apt-get update

Run the following command to install the latest stable version of MongoDB:

$ Sudo apt-get install mongodb-10gen

After the command is executed, MongoDB is installed.

4. Installation of the specified version

You can install an earlier version of MongoDB using a mongodb-10gen package. To install the specified version, you can:

$ Apt-get install mongodb-10gen = 2.2.3

Note that during use, it is possible that when you install other software, apt-get will automatically upgrade your mongodb-10gen package, to prevent the upgrade, you need to use this command:

$ Echo "mongodb-10gen hold" | dpky -- set-selections

5. Configure MongoDB

You can configure mongodb through the/etc/MongoDB. conf file. The control script is in/etc/init. d/mongodb.

MongoDB instances store data in/var/lib/mongodb data files, and logs are recorded in/var/log/mongodb log files.

6. Start and Stop MongoDB

Command to start MongoDB:

$ Sudo service mongodb start

You can check whether mongod runs successfully by checking the log file/var/log/mongodb. log.

Command to stop MongoDB:

$ Sudo service mongodb stop

Restart MongoDB:

$ Sudo service mongodb restart

VII. mongos description

Mongos is only used for MongoDB shard deployment and generally does not run on the same system running mongod.

8. Use MongoDB

Run the following command on the terminal:

$ Mongo

MongoDB shell version: 2.4.3

Connecting to: test

Welcome to the MongoDB shell.

For interactive help, type "help ".

For more comprehensive documentation, see

Http://docs.mongodb.org/

Questions? Try the support group

Http://groups.google.com/group/mongodb-user

> Db. test. save ({a: 1 })

> Db. test. find ()

{"_ Id": ObjectId ("5366ac7360a98819281b5414"), "a": 1}

>

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.