CentOS Yum installation MongoDB and PHP extensions

Source: Internet
Author: User
Tags install php install mongodb mongodb mongodb server

One, install mongodb,php extension?

1 [root@localhost ~] # yum Install Php-pecl-mongo MongoDB mongodb-devel mongodb-server

PHP extensions, MongoDB server, MongoDB customers installed.

Second, configure/etc/mongodb.conf?

1 2 3 4 5 6 7 [Root@localhost www]# cat/etc/mongodb.conf |awk ' {if ($!~/^$/&& $!~/^#/) {print $}} ' Logpath=/var/log/mong Odb/mongodb.log//Log position fork = TRUE//Background run logappend=true//append log port = 27017//Port Dbpath=/var/lib/mongo DB//database path Pidfilepath=/var/run/mongodb/mongodb.pid//pid path

It's basically all configured, but why didn't you create the/var/lib/mongodb folder when Yum was installed?

1 2 [Root@localhost Lib] # mkdir-p/var/lib/mongodb [root@localhost Lib] # chown Mongodb:mongodb-r/var/lib/mongodb/

Three, start the MongoDB server and view it?

1 2 3 4 5 [Root@localhost www] #/etc/init.d/mongod start//view [root@localhost www] # netstat-tpnl|grep 27017 TCP 0 0 0. 0.0.0:27017 0.0.0.0:* LISTEN 4641/mongod

So the MongoDB will be able to move normally.
See if the PHP extensions are loaded,




Http://www.mongodb.org/display/DOCS/CentOS+and+Fedora+Packages
10gen currently publishes RPM packages that are available for x86 and x86_64 platforms that can be installed directly with Yum. The RPM package is named Mongo-10gen and Mongo-10gen-server (stable version can be used in the production environment), or mongo-10gen-unstable and mongo-10gen-unstable-server (Beta, Can be used in a test environment).
Install the 64-bit Yum applicable rpm package, edit/etc/yum.repos.d/10gen.repo (command: Vi/etc/yum.repos.d/10gen.repo), and add the following code:
[10gen]
Name =10gen Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64
gpgcheck=0
Install the 32-bit Yum applicable rpm package, edit/etc/yum.repos.d/10gen.repo, and add the following code:
[10gen]
Name=10gen Repository
baseurl=http:// downloads-distro.mongodb.org/repo/redhat/os/i686
Gpgcheck=0
Note: If you have already installed MongoDB, you need to upgrade to a new version, preferably remove the installed Mongo-stable "," Mongo-stable-server "," mongo-unstable "or" mongo-unstable-server "installation package, and then install the new version.
OK, the following can be installed directly:
Yum install Mongo-10gen mongo-10gen-server
After successful installation, you can control the start/stop/reboot by scripting
/etc/init.d/ MongoDB Start/stop/restart
If the startup display succeeds, you can enter at the command line:
MONGO test and manipulate the database.

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.