How to install MongoDB on Ubuntu

Source: Internet
Author: User
Tags install mongodb mongodb version

Http://songgz.iteye.com/blog/1139345

The following describes how to install MongoDB on Ubuntu 11.04.
1. Add 10gen package to source. List.10gen package contains the latest MongoDB version. Add the following lines at the end of the file "/etc/APT/sources. List.

Java code  
  1. Deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart Dist 10gen


For example, use nano to edit the file "source. List" and add the 10gen package as follows.

Java code  
  1. $ Sudo nano/etc/APT/sources. List


File:/etc/APT/sources. List.

Java code  
  1. #... Content omitted...
  2. # This software is not part of ubuntu, but is offered by third-party
  3. # Developers who want to ship their latest software.
  4. Deb http://extras.ubuntu.com/ubuntu natty main
  5. The Deb-Src http://extras.ubuntu.com/ubuntu natty main
  6. # Mongo repo ############### New Line
  7. Deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart Dist 10gen


2. Add the GPG key. 
10gen package requires the GPG key. Import it:

Java code  
  1. Sudo apt-key adv -- keyserver keyserver.ubuntu.com -- Recv 7f0ceb10


3. Update the package. 
Revise "/etc/APT/sources. List ".

Java code  
  1. Sudo apt-Get update


Now, a new "mongodb-10gen-an image-oriented, document-oriented database is effective for installation.
4. Install mongodb-10gen 
Everything is ready. Now you can install MongoDB package:

Java code  
  1. Sudo apt-Get install mongodb-10gen


5. aftercare. 
Now, MongoDB has been installed, and the script for starting and automatically starting MongoDB is generated to "/etc/init/mongo" and "/etc/init. d/mongo". In addition, all MongoDB files are stored in the "/usr/bin" folder.
The main configuration file "MongoDB. conf" is put into "/etc/MongoDB. conf", where you can modify the custom configuration.
File: MongoDB. conf is as follows.

Java code  
  1. # MongoDB. conf
  2. # Where to store the data.
  3. # Note: If you run MongoDB as a non-root user (recommended) You may
  4. # Need To create and Set permissions for this directory manually,
  5. # E.g., if the parent directory isn' t mutable by the MongoDB user.
  6. Dbpath =/var/lib/MongoDB
  7. # Where to log
  8. Logpath =/var/log/MongoDB. Log
  9. Logappend = true
  10. # Port = 27017
  11. #......


6. Verify. 
Use Mongo to connect to MongoDB to verify it.

Java code  
    1. $ Mongo
    2. MongoDB shell version: 1.8.1
    3. Connecting to: Test
    4. >
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.