Install MongoDB in Ubuntu 12.04 with PHP driver

mongodb-logo

Install MongoDB:

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
sudo apt-get update
sudo apt-get install mongodb-10gen

Install MongoDB PHP driver:

sudo apt-get install php-pear php5-dev
sudo pecl search mongo
sudo pecl install mongo

The installation process has created a file called /etc/php5/conf.d/mongo.ini that loads the extension for MongoDB with PHP5.

Then restart Apache:

sudo service apache2 restart

Start, stop and restart MongoDB:

sudo service mongodb start
sudo service mongodb stop
sudo service mongodb restart

Configuration file:

/etc/mongodb.conf

Log file:

/var/log/mongodb/mongodb.log

Data files:

/var/lib/mongodb

Ref: http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/

You might also like

Fix “following signatures couldn’t be verified because the public key is not available” in Ubuntu
If you get a message like this when updating with apt-get:W: GPG error: http://extras.ubuntu.com...

Install MongoDB and the PHP driver in CentOS
Install MongoDB serverCreate the /etc/yum.repos.d/mongodb-org-3.0.repo file with this content:name=MongoDB...

Install script for XBMC in Raspbian
# Install XBMC sudo sh -c "echo 'deb http://archive.mene.za.net/raspbian wheezy contrib' > /etc/apt/sources.list.d/mene.list" sudo...

Install and configure MongoDB and PHP driver with MacPorts
Installing and configuring MongoDB with MacPortsInstalling MongoDB with MacPorts is as easy as...

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.