Installing MongoDB
1, the following to install MongoDB, first download:
cd/usr/src wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.6.4.tgz
(if download is slow, you can manually download and upload the server, manually download the reference address: HTTP://PECL.PHP.NET/PACKAGE/MONGODB)
2, unzip, enter the directory:
tar -zxvf mongodb-linux-x86_64-2.6. 4. tgz-c/usr/src cd mongodb-linux-x86_64-2.6. 4
3. Create a directory of databases and logs:
mkdir Log mkdir DB
4. Start in the background running mode:
./bin/mongod--dbpath=./db--logpath=./log/mongodb.log--fork--auth
The following is displayed:
until for connections. 4623 Child Process started successfully, parent exiting
5. Set Boot start:
Echo " /usr/src/mongodb-linux-x86_64-2.6.4/bin/mongod--dbpath=/usr/src/mongodb-linux-x86_64-2.6.4/db--logpath=/ Usr/src/mongodb-linux-x86_64-2.6.4/log/mongodb.log--fork--auth" >>/etc/rc.local
OK, fix it, and then you can see the lower port netstat -nalupt | grep mongo
:
0 0 0.0. 0.0:270170.0. 0.0 4623/./bin/mongod
Installing MongoDB Extensions
1. Download Php_mongo extension:
wget http://pecl.php.net/get/mongo-1.6.12.
(if download is slow, you can manually download and upload the server, manually download the reference address: Http://pecl.php.net/package/mongo)
2, unzip, enter the directory:
tar -xvzf mongo-1.6. A CD MONGO-1.6. A
3, compile, install:
phpize. /configure--with-php-config=/usr/bin/php-configmake doinstall
4, modify the php.ini configuration file, add a bit of content:
Extension=mongo.so
5. Restart PHP-FPM:
Systemctl Restart PHP-FPM
MONGO extensions for MongoDB and PHP installed under CentOS