Skip to content

Instantly share code, notes, and snippets.

@bruceh48
Created September 28, 2017 13:20
Show Gist options
  • Save bruceh48/8cb43906074e9874fc2dcb9660126861 to your computer and use it in GitHub Desktop.
Save bruceh48/8cb43906074e9874fc2dcb9660126861 to your computer and use it in GitHub Desktop.
Install MongoDB on Ubuntu16.04
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
sudo apt-get update && sudo apt-get -y upgrade
sudo apt-get install -y mongodb-org
cd /lib/systemd/system/
nano mongod.service
[Unit]
Description=High-performance, schema-free document-oriented database
After=network.target
Documentation=https://docs.mongodb.org/manual
[Service]
User=mongodb
Group=mongodb
ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
# Start mongodb and add it as service to be started at boot time:
sudo systemctl start mongod
sudo systemctl enable mongod
# Check that it has started:
netstat -plntu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment