歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> CentOS 5下安裝MongoDB 1.7.5

CentOS 5下安裝MongoDB 1.7.5

日期:2017/2/28 16:21:05   编辑:Linux教程

一,使用官方編譯好的BIN來執行

$ cd /usr/local/src
$ wget http://downloads.mongodb.org/linux/mongodb-linux-x86_64-1.7.5.tgz

# mkdir -p /data/db/
# chown hoge /data/db/
# ln -s /usr/local/src/mongodb-linux-x86_64-1.7.5/ /opt/mongobin

// 起動
# /opt/mongobin/bin/mongod &

// 測試
$ /opt/mongobin/bin/mongo> db.foo.save( { a : 1 } )
> db.foo.find()


二,使用源代碼編譯


$ wget http://downloads.mongodb.org/src/mongodb-src-r1.7.5.tar.gz
$ tar zxvf xxx.tar.gz
$ cd xxx
$ scons all # scons --prefix=/opt/mongosrc install

需要安裝的依賴庫

boost_1_42_0
js-1.7.0
pcre-7.4
scons-2.1.0


scons
Use scons to build MongoDB and related utilities and libraries. See the SConstruct file for details.
Run scons --help to see all options.

Targets
Run scons <target>.
scons .
scons all
scons mongod build mongod
scons mongo build the shell
scons shell generate (just) the shell .cpp files (from .js files)
scons mongoclient build just the client library (builds libmongoclient.a on unix)
scons test build the unit test binary test

Options
--d debug build
--dd debug build with _DEBUG defined (extra asserts etc.)
--release
--32 force 32 bit
--64 force 64 bit
--clean

Troubleshooting
scons generates a config.log file. See this file when there are problems building.

Copyright © Linux教程網 All Rights Reserved