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.