Skip to content

Instantly share code, notes, and snippets.

@maxfi
Last active June 10, 2018 19:15
Show Gist options
  • Save maxfi/a328e7033374921c5543 to your computer and use it in GitHub Desktop.
Save maxfi/a328e7033374921c5543 to your computer and use it in GitHub Desktop.
Install latest MongoDB tools and shell
#!/bin/bash
### DEPRECATED!!!! Refer to https://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/
### ALSO REMOVE NPM PACKAGE `mongo-hacker` AS IT BREAKS STUFF!!!
exit
# ------------------
# Script setup
# ------------------
# Exit on failure.
set -e
# Check for root.
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
# ----------------------------
# Remove previous versions
# ----------------------------
apt-get remove mongodb-clients
# ---------------------
# Update apt sources
# ---------------------
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 multiverse" > /etc/apt/sources.list.d/mongodb-org-3.2.list
apt-get update
# ------------------------
# Install
# ------------------------
apt-get install -y \
mongodb-org-shell=3.2.4 \
mongodb-org-tools=3.2.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment