Advertisement
shokti

ubuntu 12.10 - mongodb and php driver install

Jan 30th, 2013
367
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. add mongodb repo in the sources.list:
  2. sudo nano /etc/apt/sources.list
  3.  
  4. add below:
  5. deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen
  6.  
  7. add mongodb repo key(make sure port 11371 is open):
  8. sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
  9.  
  10. update repo:
  11. sudo apt-get update
  12.  
  13. install mongodb:
  14. sudo apt-get install mongodb-10gen
  15.  
  16. check if mongo process is running:
  17. ps aux | grep mongo
  18.  
  19. to start, stop, restart mongodb:
  20. sudo service mongodb start
  21. sudo service mongodb stop
  22. sudo service mongodb restart
  23.  
  24. to test mongo by going mongo command prompt:
  25. mongo
  26.  
  27. at the mongo prompt:
  28. >show dbs;
  29. > db.test.save( { a: 1 } )
  30. > db.test.find()
  31.  
  32. install php driver for mongodb:
  33. sudo apt-get install php-pear php5-dev
  34. sudo apt-get install make
  35.  
  36. check mongo php driver:
  37. pecl search mongo
  38.  
  39. install mongo php driver:
  40. sudo pecl install mongo
  41.  
  42. add mongo extension in php.ini:
  43. sudo nano /etc/php5/apache2/php.ini
  44.  
  45. add below:
  46. extension = mongo.so
  47.  
  48.  
  49. -----
  50. note: use mongo command to go to the mongo command shell.
  51.  
  52. -----
  53. note: install phpmoadmin to administer mongodb.
  54. cd /var/www
  55. sudo wget http://phpmoadmin.com/file/phpmoadmin.zip
  56. sudo unzip phpmoadmin.zip
  57.  
  58. and then browse to http://localhost/moadmin.php in the internet browser.
  59.  
  60. ----
  61. note: add this to php.ini if mongodb is in another server.
  62. [Mongo]
  63. ; default host 127.0.0.1
  64. ; custom host: the IP address of the database server
  65. mongo.default_host = "xxx.xxx.xxx.xxx"
  66.  
  67. ----
  68. note: if you have problem running mongo then try using below to install:
  69. sudo apt-get install mongodb
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement