下载安装
wget -c http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.6.4.tgz
tar -zxvf mongodb-linux-x86_64-2.6.4.tgz -C /usr/local/
mv /usr/local/mongodb-linux-x86_64-2.6.4 /usr/local/mongodb
mkdir -p /usr/local/mongodb/data
touch /usr/local/mongodb/logs
编辑配置文件
vim /usr/local/mongodb/bin/mongodb.conf
#start as daemon and need authentication
bind_ip=127.0.0.1
port=27017
fork=true
maxConns=5000
nojournal=true
dbpath=/usr/local/mongodb/data/
#logpath=/usr/local/mongodb/logs
logpath=/dev/null
#auth=true
其中bind_ip=127.0.0.1 只本服可用。 logpath=/dev/null 禁止生成日志了。禁止验证#auth=true
启动(建议放到自启中)
/usr/local/mongodb/bin/mongod -f /usr/local/mongodb/bin/mongodb.conf
安装php扩展
wget http://pecl.php.net/get/mongo-1.5.5.tgz
tar zxvf mongo-1.5.5.tgz
cd mongo-1.5.5/
/usr/local/php/bin/phpize
./configure –with-php-config=/usr/local/php/bin/php-config
make && make install
cd ../
php.ini中加入 extension = “mongo.so”
最后各种重启就行了