Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add mongodb repo in the sources.list:
- sudo nano /etc/apt/sources.list
- add below:
- deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen
- add mongodb repo key(make sure port 11371 is open):
- sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
- update repo:
- sudo apt-get update
- install mongodb:
- sudo apt-get install mongodb-10gen
- check if mongo process is running:
- ps aux | grep mongo
- to start, stop, restart mongodb:
- sudo service mongodb start
- sudo service mongodb stop
- sudo service mongodb restart
- to test mongo by going mongo command prompt:
- mongo
- at the mongo prompt:
- >show dbs;
- > db.test.save( { a: 1 } )
- > db.test.find()
- install php driver for mongodb:
- sudo apt-get install php-pear php5-dev
- sudo apt-get install make
- check mongo php driver:
- pecl search mongo
- install mongo php driver:
- sudo pecl install mongo
- add mongo extension in php.ini:
- sudo nano /etc/php5/apache2/php.ini
- add below:
- extension = mongo.so
- -----
- note: use mongo command to go to the mongo command shell.
- -----
- note: install phpmoadmin to administer mongodb.
- cd /var/www
- sudo wget http://phpmoadmin.com/file/phpmoadmin.zip
- sudo unzip phpmoadmin.zip
- and then browse to http://localhost/moadmin.php in the internet browser.
- ----
- note: add this to php.ini if mongodb is in another server.
- [Mongo]
- ; default host 127.0.0.1
- ; custom host: the IP address of the database server
- mongo.default_host = "xxx.xxx.xxx.xxx"
- ----
- note: if you have problem running mongo then try using below to install:
- sudo apt-get install mongodb
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement