MongoDB是一个基于分布式文件存储的数据库,与Redis 同样,基于NoSql 技术, 由C++语言编写。旨在为WEB应用提供可扩展的高性能数据存储解决方案,接下来为在Ubuntu 上安装及运行mongodb 过程。
1. 依赖包安装,mongodb 用boost库,js引擎(spider monkey 或者V8), 正则表达式库pcre.
apt-get -y install tcsh git-core scons g++
apt-get -y install libpcre++-dev libboost-dev libreadline-dev xulrunner-1.9.2-dev
apt-get -y install libboost-program-options-dev libboost-thread-dev libboost-filesystem-dev libboost-date-time-dev
2.编译
2.1 获取源码,可以获取主分支,也可以编译子分支
git clone git://github.com/mongodb/mongo.git
cd mongo
# pick a stable version unless doing true dev
git tag -l
# Switch to a stable branch (unless doing development) --
# an even second number indicates "stable". (Although with
# sharding you will want the latest if the latest is less
# than 1.6.0.) For example:
git checkout r2.0.0
编译
scons all
3.安装
--prefix 指定 mongodb 库存放位置
scons --prefix=/opt/mongo install
4. 运行
# sudo mkdir -p /data/db
# sudo ./mongod