Skip to content

Instantly share code, notes, and snippets.

@meSingh
Created June 13, 2016 20:35
Show Gist options
  • Save meSingh/4a39c8ee5d967a3ff995a2c4ccdc141e to your computer and use it in GitHub Desktop.
Save meSingh/4a39c8ee5d967a3ff995a2c4ccdc141e to your computer and use it in GitHub Desktop.
MongoDB Setup on Ubuntu 14.04 with PHP7
#!/bin/bash
# MongoDB Setup on Ubuntu 14.04 with PHP7
# Source:
#1. Import the public key used by the package management system:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
#2. Create a list file for MongoDB.
echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
#3. Reload local package database
sudo apt-get update
#4. Install the MongoDB packages
sudo apt-get install -y mongodb-org
#5. Install OpenSSL PHP Library
sudo apt-get install -y autoconf g++ make openssl libssl-dev libcurl4-openssl-dev pkg-config libsasl2-dev libpcre3-dev
#6. Install MongoDB PHP Driver
sudo pecl install mongodb
#7. Add mongodb extension to php.ini
sudo su -
echo "extension=mongodb.so" >> /etc/php/7.0/fpm/php.ini
echo "extension=mongodb.so" >> /etc/php/7.0/cli/php.ini
logout
@meSingh
Copy link
Author

meSingh commented Jun 13, 2016

Just run it as:
sudo sh mongodb-setup.sh

@omar331
Copy link

omar331 commented Apr 30, 2018

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment