CentOS installation MongoDB

Source: Internet
Author: User
Tags mongodb client mongodb support

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.