Mongodb2.4.3 installation in ubuntu13.04

Source: Internet
Author: User
Tags install mongodb mongodb version
Mongodb2.4.3 installation in ubuntu13.04

Author: chszs, reprinted with note. Blog homepage: http://blog.csdn.net/chszs
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 <richard@10gen.com>" 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.