william-r
3/27/2018 - 9:27 PM

Install Mongo 3.6 on Ubuntu 16.04

sudo nano /etc/systemd/system/mongodb.service
sudo apt-get update && sudo apt-get install mongodb-org -y
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5
[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
storage:
  dbPath: /var/lib/mongodb
  journal:
    enabled: true

systemLog:
  destination: file
  logAppend: true
  path: /var/log/mongodb/mongod.log

net:
  port: 27017
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list
sudo apt-get update
sudo apt-get install -y mongodb-org

#if it creates this file, delete it
sudo rm /etc/systemd/system/mongodb.service
sudo nano /etc/systemd/system/mongodb.service

#Append the contents of mongodb.service file below

#if it creates this file, delete it
sudo rm /etc/mongod.conf
sudo nano /etc/mongod.conf

#Append the contents of mongod.conf file below

#Start your system
sudo systemctl start mongodb
#If service is masked, unmask it
sudo systemctl unmask mongodb
#check status
sudo systemctl status mongodb
#Enable automatic load
sudo systemctl enable mongodb
#Start MongoDB
sudo systemctl start mongodb