Skip to content

Instantly share code, notes, and snippets.

@delebash
Forked from meSingh/mongodb-setup.sh
Created November 16, 2016 18:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save delebash/b860d9ee827fdea56276e9111ef270e7 to your computer and use it in GitHub Desktop.
Save delebash/b860d9ee827fdea56276e9111ef270e7 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment