This article is about the complete installation configuration process for using MongoDB under CentOS.
Replace the Yum source
We want to install it through Yum, so it's quicker to compare, but the CentOS default Yum environment doesn't have what we need, so we need to proactively change the source of the Yum source to 163.
First Get 163 sources:
# wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
Then we will back up our own native Yum:
#mv CentOS-Base.repo CentOS-Base.repo.bak
Then change the downloaded 163 source to a native source:
#mvCentOS6-Base-163.repo CentOS-Base.repo
Next the Yum source Update operation:
#yum clean all#yum makecache#yum update -y
This new Yum source is configured to complete.
Installing the MongoDB Database
Next we need to install the MongoDB database under CentOS.
#yum instll mongodb
Then install the server side:
#yum install mongodb-server
Next start MongoDB:
#service mongod start
Then enter MONGO:
#mongo
The above results show that MongoDB installation is successful.
Configuring Php-mongo Extensions
or install via Yum:
#yum install php-pecl-mongo
Php_info () will display MONGO after successful installation:
Test MongoDB
Test MongoDB with PHP code to see if it works:
$mongo = new Mongo();$alldb = $mongo->listDBs();//获取所有数据库名称echo$alldb;
If normal returns, the PHP operation MongoDB is successful.
The following specific additions and deletions to check the API: Official documents
'). addclass (' pre-numbering '). Hide (); $ (this). addclass (' has-numbering '). Parent (). append ($numbering); for (i = 1; i <= lines; i++) {$numbering. Append ($ ('
'). Text (i)); }; $numbering. FadeIn (1700); }); });
The above describes the CentOS under the use of the MongoDB detailed installation process, including the CentOS6 aspects of the content, I hope that the PHP tutorial interested in a friend helpful.