Install MongoDB and PHP MongoDB Driver in Ubuntu 14.04
Description
MongoDB is a very famous NOSQL database. The following is the installation of MongoDB in Ubuntu 14.04, as well as the configuration for PHP (driver Installation, etc.). This method is applicable to Homestead.
Install MongoDB
1. Add Source
Sudo apt-key adv -- keyserver hkp: // keyserver.ubuntu.com: 80 -- recv 7F0CEB10
Echo 'Destroy http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen '| sudo tee/etc/apt/sources. list. d/mongodb. list
Sudo apt-get update
2. Start Installation
You can customize the installed Package here.
Sudo apt-get install-qq mongodb-org
Check whether the installation is complete:
$ Ps-ef | grep mongo
Mongodb 15683 1 1? 00:00:37/usr/bin/mongod -- config/etc/mongod. conf
Check version:
$ Mongo -- version
MongoDB shell version: 2.6.6
$ Mongo
> Db. test. save ({test: 100 })
> Db. test. find ()
{"_ Id": ObjectId ("549253f4d91767276c02fc14"), "test": 100}
Path information and default parameter description:
• Sources:/usr/bin/
• Logs:/var/log/mongodb/mongod. log
• Data:/var/lib/mongodb/
• Default ip: 127.0.0.1
• Default port MongoDB is listening: 27017
You can modify the above information by editing/etc/mongod. conf.
Enable/disable
$ Sudo service producer D start
$ Sudo service producer D stop
$ Sudo service producer D restart
Install PHP Mongodb Driver
1. install Driver
Echo "no"> answers.txt
Sudo pecl install mongo <answers.txt
Rm answers.txt
2. Enable PHP Extension
Echo 'extension = mongo. so' | sudo tee/etc/php5/mod-available/mongo. ini
Sudo ln-s/etc/php5/mod-available/mongo. ini/etc/php5/fpm/conf. d/mongo. ini
Sudo ln-s/etc/php5/mod-available/mongo. ini/etc/php5/cli/conf. d/mongo. ini
Restart the server
Sudo service php5-fpm restart
Verify whether the installation is successful
$ Php-I | grep 'mongo'
MongoDB Support => enabled
: Sparkles:
For more MongoDB tutorials, see the following:
CentOS compilation and installation of php extensions for MongoDB and mongoDB
CentOS 6 install MongoDB and server configuration using yum
Install MongoDB2.4.3 in Ubuntu 13.04
MongoDB beginners must read (both concepts and practices)
MongoDB Installation Guide for Ubunu 14.04
MongoDB authoritative Guide (The Definitive Guide) in English [PDF]
Nagios monitoring MongoDB sharded cluster service practice
Build MongoDB Service Based on CentOS 6.5 Operating System
MongoDB details: click here
MongoDB: click here