Skip to content

Instantly share code, notes, and snippets.


ervinb/ Secret

Last active May 23, 2017
What would you like to do?
#! /usr/bin/env bash
# Add the line below to your setup command in Project Settings
# wget && bash
# Note: reset your dependency cache in Project Settings > Admin, before running this script
echo "---------------------------------------"
echo "# Removing currently installed MongoDB"
echo "---------------------------------------"
sudo apt-get purge -y mongodb-org* &>/dev/null
sudo rm -rf /var/lib/mongodb
echo "---------------------------------------"
echo "# Installing MongoDB version $MONGODB_VERSION"
echo "---------------------------------------"
# add PPA for 2.6.x
sudo apt-key adv --keyserver --recv-keys 9ECBEC467F0CEB10
echo 'deb dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb-dep.list
# add PPA for 3.0.x
echo "deb trusty/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
# add PPA for 3.2.x
sudo apt-key adv --keyserver --recv-keys D68FA50FEA312927
echo "deb trusty/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
# install MongoDB
install-package --update mongodb-org-server=$MONGODB_VERSION mongodb-org-mongos=$MONGODB_VERSION mongodb-org-shell=$MONGODB_VERSION mongodb-org-tools=$MONGODB_VERSION
# print post-installation info
echo "---------------------------------------"
printf "\nInstallation complete.\n\nDetails:\n $(mongod --version)\n"
printf "\nService status:\n $(sudo service mongod status)\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.