Install MongoDB and PHP MongoDB Driver in Ubuntu 14.04

Source: Internet
Author: User
Tags install mongodb mongodb driver php mongodb mongodb support

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

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.