標籤:export
系統版本:32位CENTOS5.5
安裝MongoDB
安裝scons、js
yum install -y boost boost-devel pcre pcre-develwget http://sourceforge.net/projects/scons/files/scons/2.1.0.alpha.20101125/scons-2.1.0.alpha.20101125.tar.gz/downloadtar xvf scons-2.1.0.alpha.20101125.tar.gzcd scons-2.1.0.alpha.20101125python setup.py installcd ..wget http://ftp.mozilla.org/pub/mozilla.org/js/js-1.7.0.tar.gztar zxvf js-1.7.0.tar.gzcd js/src/export CFLAGS="-DJS_C_STRINGS_ARE_UTF8"make -f Makefile.refJS_DIST=/usr gmake -f Makefile.ref exportcd ../..
安裝MongoDB
wget http://fastdl.mongodb.org/linux/mongodb-linux-i686-2.0.4.tgztar xvf http://fastdl.mongodb.org/linux/mongodb-linux-i686-2.0.4.tgzmv mongodb-linux-i686-2.0.4 /usr/local/mongodbmkdir -pv /usr/local/mongodb/data /usr/local/mongodb/etc /usr/local/mongodb/log
設定檔
cat > /usr/local/mongodb/etc/mongod.conf <<‘EOF‘# log file to send write to instead of stdout – has to be a file, not directorylogpath=/usr/local/mongodb/log/mongod.log# append to logpath instead of over-writinglogappend=true# fork and run in backgroundfork = true# specify port numberport = 27017# comma separated list of ip addresses to listen on – all local ips by default#bind_ip = 192.168.51.119# directory for datafilesdbpath = /usr/local/mongodb/data# full path to pidfile (if not set, no pidfile is created)pidfilepath = /usr/local/mongodb/log/mongod.pid# Enables periodic logging of CPU utilization and I/O wait#cpu = true# Turn on/off security. Off is currently the default#noauth = trueauth = true# Verbose logging output.#verbose = true# Inspect all client data for validity on receipt (useful for# developing drivers)#objcheck = true# Enable db quota managementquota = true# Set oplogging level where n is# 0=off (default)# 1=W# 2=R# 3=both# 7=W+some reads#oplog = 0# Diagnostic/debugging option#nocursors = true# Ignore query hints#nohints = true# Disable the HTTP interface (Defaults to localhost:27018).#nohttpinterface = true# Turns off server-side scripting. This will result in greatly limited# functionality#noscripting = true# Turns off table scans. Any query that would do a table scan fails.#notablescan = true# Disable data file preallocation.#noprealloc = true# Specify .ns file size for new databases.nssize = 16# Accout token for Mongo monitoring server.#mms-token = <token># Server name for Mongo monitoring server.#mms-name = <server-name># Ping interval for Mongo monitoring server.#mms-interval = <seconds># Replication Options# in replicated mongo databases, specify here whether this is a slave or master#slave = true#source = master.example.com# Slave only: specify a single database to replicate#only = master.example.com# or#master = true#source = slave.example.comEOF
啟動指令碼
cat > /etc/rc.d/init.d/mongod <<‘EOF‘#!/bin/bash## mongodb Startup script for the mongodb server## chkconfig: - 64 36# description: MongoDB Database Server## processname: mongodb## Source function library. /etc/rc.d/init.d/functionsprog="mongod"mongod="/usr/local/mongodb/bin/mongod"OPTIONS=" -f /usr/local/mongodb/etc/mongod.conf"RETVAL=0start() { echo -n $"Starting $prog: " $mongod $OPTIONS RETVAL=$? echo [ $RETVAL -eq 0 ] && touch /usr/local/mongodb/log/$prog return $RETVAL}stop() { echo -n $"Stopping $prog: " killproc $prog RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f /usr/local/mongodb/log/$prog return $RETVAL}reload() { echo -n $"Reloading $prog: " killproc $prog -HUP RETVAL=$? echo return $RETVAL}case "$1" in start) start ;; stop) stop ;; restart) stop start ;; condrestart) if [ -f /usr/local/mongodb/log/$prog ]; then stop start fi ;; reload) reload ;; status) status $mongod RETVAL=$? ;; *) echo $"Usage: $0 {start|stop|restart|condrestart|reload|status}" RETVAL=1esacexit $RETVALEOF# 執行許可權chmod a+x /etc/rc.d/init.d/mongod# 添加到開機啟動項chkconfig --add mongodchkconfig mongod on
安裝php mongo 擴充
wget http://pecl.php.net/get/mongo-1.2.2.tgztar zxf mongo-1.2.2.tgzcd mongo-1.2.2phpize./configuremake && make install
完成後在php.ini檔案增加一行
[MongoDB]extension=mongo.so
成功的話phpinfo()會看到mongo一項
愛慕爾商城歡迎您的光臨!
穿衣打扮
城市物語
本文出自 “linux營運” 部落格,謝絕轉載!
kv永久儲存mongodb