How to install mongoDB on Ubuntu

來源:互聯網
上載者:User
Ubuntu上如何安裝mongodb資料庫(How to install mongoDB on Ubuntu) Published: May 19, 2011 , Updated: May 19, 2011 , Author: mkyong

下文將會介紹如何安裝mongodb 在你的ubuntu11.10

步驟總結:
在你的source.list添加10個gen包 (Add 10gen package to source.list) 升級系統的包(Update package)用sudo apt-get update
添加GPG密鑰(Add GPG Key) 安裝mongodb-10gen
完事
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, you 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 is not part of Ubuntu, but is offered by third-party## developers who want to ship their latest software.deb http://extras.ubuntu.com/ubuntu natty maindeb-src http://extras.ubuntu.com/ubuntu natty main #mongo repo ###############new linedeb 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, 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 is installed, started, and auto start mongoDB script is generated to “/etc/init/mongo” and “/etc/init.d/mongo“. In addition, all mongoDB files are copied to “/usr/bin” folder.

The main configuration file “mongodb.conf” is located at “/etc/mongodb.conf“, change the values to customize your mongoDB server.

File : mongodb.conf

 # mongodb.conf # Where to store the data. # Note: if you run mongodb as a non-root user (recommended) you may# need to 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 loglogpath=/var/log/mongodb/mongodb.log logappend=true #port = 27017#......
6. Verification

To verify it, just connect it with “mongo

$ mongoMongoDB shell version: 1.8.1connecting to: test>

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.