Mongodb編譯安裝

 ################################################# Mongodb 安裝 #############################################################

cd /tool
 
####安裝scons: 下載scons######
wget http://prdownloads.sourceforge.net/scons/scons-2.1.0.tar.gz
tar zxf scons-2.1.0.tar.gz
cd scons-2.1.0
python setup.py install
 
cd ../
 
########  安裝spidermonkey庫,下載支持c的js api庫 ######### 用V8 這個不要用了 ###############
 
wget http://ftp.mozilla.org/pub/mozilla.org/js/js-1.7.0.tar.gz
 
tar zxvf js-1.7.0.tar.gz
cd js/src/
export CFLAGS="-DJS_C_STRINGS_ARE_UTF8"
make -f Makefile.ref
JS_DIST=/usr gmake -f Makefile.ref export
cd /tool
 
################################ Python #####################################################
cd /tool
wget http://python.org/ftp/python/2.6.4/Python-2.6.4.tar.bz2
tar xvf Python-2.6.4.tar.bz2
cd Python-2.6.4
./configure
# ./configure --prefix=/usr/local/python2.6
# ln -sf /usr/local/python/bin/python2.6 /usr/bin/python2.6
make
make test
make install
 
 
################################ pcre ######################
cd /tool
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.20.tar.gz
 
tar vxf pcre-8.20.tar.gz
cd pcre-8.20
./configure --prefix=/usr/local/pcre --enable-utf8 --enable-unicode-properties
make && make install
#####在安裝mongo的時候,提示找不到pcrecpp的頭文件的話,就將安裝的pcre的頭文件拷貝到/usr/include下面
###cp /usr/local/pcre/include/* /usr/include/
 
####################################### 下載編譯安裝MongoDb #######################################
cd /tool
wget http://downloads.mongodb.org/src/mongodb-src-r2.0.3.tar.gz
tar -zxvf mongodb-src-r2.0.3.tar.gz
cd mongodb-src-r2.0.3
scons all
 
#scons all --usev8
 
#--staticlibpath=/usr/local/lib --staticlib=boost_system,boost_thread,boost_filesystem,boost_program_options
 
## scons可能出現找不到pcre庫的現象(修改/etc/ld.so.conf也無用,是scons自身的問題),這時需要打開mongodb-src-r1.8.0下的SConstruct,查找【 linux2"== os.sys.platform:】,在LIBPATH後面添加上pcrecpp庫的安裝路徑,在LIBS後添加上pcrecpp庫名,再重新scons all即可(操作:vim SConstruct;原來:env.Append( LIBPATH=["/usr/lib64" , "/lib64" ] ) ;修改後env.Append( LIBPATH=["/usr/lib64" , "/lib64" ,"/usr/local/pcre/lib"]);  接下來在env.Append( LIBS=["pthread"] )後面添加 env.Append( LIBS=["libpcrecpp"] )  )
 
mkdir -p /data/mongo
 
######### 如果需要安裝lib和head,使用如下方式安裝
scons --prefix=/data/mongo --full install
####### scons --prefix=/usr/local/webserver/mongo install
 
mkdir -p /data/mongo/etc /data/mongo/data /data/mongo/log/ /data/mongo/repair
vim  /data/mongo/etc/mongo.conf
 
##在mongo.conf中添加下面的內容
dbpath = /usr/local/webserver/mongo/data
logpath = /usr/local/webserver/mongo/mongodb.log
repairpath = /usr/local/webserver/mongo/repair
pidfilepath = /usr/local/webserver/mongo/mongodb.pid
directoryperdb = true
logappend = true
noauth = true
port = 27017
maxConns = 1024
fork = true
rest = true
quota = true
quotaFiles = 1024
nssize = 16
 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章