Ubuntu 12.04 Server 上安裝 MongoDB

來源:互聯網
上載者:User

MongoDB (from “humongous”)是一款開源的面向文檔的NoSQL 資料庫,使用C++開發,儲存格式為BSON,模式自由,高效能、易部署、易使用,儲存資料非常方便。目前已經有大量開發人員在生產環境中使用。

MongoDB官網:http://www.mongodb.org/

如何在 Ubuntu 12.04 (Precise) Server 上安裝 MongoDB

sudo apt-key adv –keyserver keyserver.ubuntu.com –recv 7F0CEB10
echo “deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen” | tee -a /etc/apt/sources.list.d/10gen.list
sudo apt-get -y update

sudo apt-get -y install mongodb-10gen

設定檔:/etc/mongodb.conf

對於基於Upstart的系統,控制指令碼在/etc/init/mongodb.conf。

預設資料檔案目錄:/var/lib/mongodb

預設記錄檔目錄: /var/log/mongodb

啟動MongoDB:   sudo service mongodb start

sudo service mongodb stop     停止

sudo service mongodb restart 重啟

測試:在終端上運行mongo開啟mongo shell

# mongo
MongoDB shell version: 2.0.7
connecting to: test

> db.test.save({a:1})
> db.test.find()
{ “_id” : ObjectId(“502b284cd9de55a0e9ca86d9″), “a” : 1 }

參考來源在這裡。我已在Ubuntu 12.04 伺服器版上安裝測試。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.