First, the use of wget download MongoDB official website installation files.
wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.6.5.tgz
Second, decompression, installation, configuration
TAR-XVF mongodb-linux-x86_64-2.6.5.tgz #解压mv mongodb-linux-x86_64-2.6.5/usr/local/mongodbmkdir-p/data/db #新建mongodb数据文件存放目录mkdir-P/data/logs #新建log文件存放目录cd/usr/local/mongodb/bin
New configuration file, MongoDB support to write the parameters into the configuration file, and then the configuration file configuration to start, we also use this method here.
VI mongodb.conf
The contents are as follows:
DBPath =/data/db #数据文件存放目录logpath =/data/logs/mongodb.log #日志文件存放目录port = 27017 #端口fork = True #以守护程序的方式启用, That is, running in the background # by accessing http://IP:28017/You can view some information about the MongoDB boot, and also monitor the statistics of MongoDB running #. In the process of using MongoDB, we can use parameters to disable the function. #修改配置文件mongodb. conf, add parameter option: Nohttpinterface = True. Nohttpinterface = True
Start the MONGO program, start with the parameters defined by the configuration file mongodb.conf
./mongod--config mongodb.conf
Boot auto Start MongoDB
Vi/etc/rc.d/rc.local
in the file, add:
/usr/local/mongodb/bin/mongod--config/usr/local/mongodb/bin/mongodb.conf
Rebind the configuration file address and access IP for MongoDB:
/usr/local/mongodb/bin/mongod--bind_ip localhost-f/usr/local/mongodb/bin/mongodb.conf
Third, testing
/usr/local/mongodb/bin/mongo# View Database list show dbs# current DB version db.version ();
Installing the MongoDB Client for PHP
Official website (Http://pecl.php.net/package/mongo)
Cd/usr/local/srcwget-c http://pecl.php.net/get/mongo-1.4.4.tgztar-xzvf./mongo-1.4.4.tgzcd./mongo-1.4.4/usr/ Local/php/bin/phpize # Use PHP's phpize command to install extensions./configure--with-php-config=/usr/local/php/bin/php-configmake & & Make Install
When you're done, edit your php.ini file to add a line.
Extension=mongo.so
CentOS installation MongoDB