Install MongoDB on Ubuntu

Source: Internet
Author: User
Tags gpg install mongodb mongodb mongodb server mongodb version parent directory
How do I install the MongoDB database on Ubuntu (I to install MongoDB on Ubuntu)Published:may, Updated:may, Author:mkyong

The following will describe how to install MongoDB in your ubuntu11.10

Summary of steps:
In your source.list add 10 gen Packs (add 10gen package to Source.list) Upgrade the System Package (update package) with sudo apt-get Update
Add GPG key (add GPG key) Install Mongodb-10gen
Done
1. ADD 10gen package to Source.list

The 10gen package contains the latest MongoDB version, append below line to the end of the file/etc/apt/sources.list "

Deb Http://downloads-distro.mongodb.org/repo/ubuntu-upstart Dist 10gen

For example, your can vim the "source.list" and append the 10gen package like this:

$ sudo vim/etc/apt/sources.list

File:/etc/apt/sources.list

#...content omitted
...
# # This software isn't part of Ubuntu, but are offered by Third-party
# # developers who want to ship their latest Software.
Deb Http://extras.ubuntu.com/ubuntu Natty main
deb-src http://extras.ubuntu.com/ubuntu Natty main
# MONGO Repo ############## #new line
deb Http://downloads-distro.mongodb.org/repo/ubuntu-upstart Dist 10gen
2. Update Package

Update the modified "/etc/apt/sources.list":

sudo apt-get update

Now, the A new "Mongodb-10gen –an object/document-oriented database" is available for install. 3. Add GPG Key

10gen package Required GPG key, import it:

sudo apt-key adv--keyserver keyserver.ubuntu.com--recv 7F0CEB10
4. Install Mongodb-10gen

Everything is ready, now you can Install the MongoDB package:

sudo apt-get install Mongodb-10gen
5. Post-Installation

Now, MongoDB are installed, started, and auto start MongoDB script is generated to "/etc/init/mongo" and "/etc /init.d/mongo". In addition, all mongoDB the files are copied to "/usr/bin" folder.

The main configuration file "mongodb.conf" is located at "/etc/mongodb.conf", and the change of the values to Custo Mize your MongoDB server.

File:mongodb.conf

# mongodb.conf
# Where to store the data.
# Note:if You run MongoDB as a non-root user (recommended) your may
# need to the Create and set permissions for this directory manually,
# e.g., if the parent directory isn ' t mutable by the MongoDB user.
Dbpath=/var/lib/mongodb
#where to log
logpath=/var/log/mongodb/mongodb.log
logappend= True
#port = 27017
# ...
6. Verification

To verify it, just connect it with "MONGO"

$ MONGO
MongoDB shell version:1.8.1
connecting to:test
>

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.