Skip to content

Instantly share code, notes, and snippets.

@mansurali901
Last active September 5, 2017 07:58
Show Gist options
  • Save mansurali901/ea1fb2f5d201e9d2fbfa09cd007fd653 to your computer and use it in GitHub Desktop.
Save mansurali901/ea1fb2f5d201e9d2fbfa09cd007fd653 to your computer and use it in GitHub Desktop.
Install Mongo 3.2.15 in Ubuntu 16.04
# This script install Mongo 3.2.15 in Ubuntu 16.04
# Author Mansur Ul Hasan
# [email protected]
# Adding gpg key
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
# Adding MongoDB repository
echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
# System APT update
apt-get update -y
# Installing MongoDB
apt-get install -y mongodb-org
# Adding Service
echo "
[Unit]
Description=High-performance, schema-free document-oriented database
After=network.target
[Service]
User=mongodb
ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf
[Install]
WantedBy=multi-user.target" >> /etc/systemd/system/mongodb.service
# Starting Mongo
systemctl start mongodb
# Checking Mongo Status
systemctl status mongodb
echo "
###################################################
Mongo DB 3.2.15 has been installed
###################################################
"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment