mongodb 直接下載官方最新包解壓就可以使用了。
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
再設置一下配制文件
vi /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
再把這行啟動命令加到啟動服本中。
我是下載最新包使用的,有的是下yum 或apt-get 安裝的。
再安裝一下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"
/etc/init.d/php-fpm restart 重啟生效。