Skip to content

Instantly share code, notes, and snippets.

@sgnn7
Created December 22, 2015 23:06
Show Gist options
  • Save sgnn7/54146c8a13c8b5ca2201 to your computer and use it in GitHub Desktop.
Save sgnn7/54146c8a13c8b5ca2201 to your computer and use it in GitHub Desktop.
Mongodb 3.2 on Ubuntu 15.10
echo '[Unit]
Description=High-performance, schema-free document-oriented database
After=syslog.target network.target
[Service]
User=mongodb
Group=mongodb
ExecStart=/usr/bin/mongod -f /etc/mongod.conf
[Install]
WantedBy=multi-user.target' > /lib/systemd/system/mongod.service
# Setup the required directories
mkdir -p /var/run/mongodb/
mkdir -p /var/log/mongodb/
mkdir -p /var/lib/mongodb/
mkdir -p /data/db/
chown mongodb:mongodb /var/run/mongodb/
chown mongodb:mongodb /var/log/mongodb/
chown mongodb:mongodb /var/lib/mongodb/
chown mongodb:mongodb /data/db
chmod 0755 /var/log/mongodb/
chmod 0755 /var/run/mongodb/
chmod 0755 /var/lib/mongodb/
chmod 0755 /data/db/
# Start the new service and enable it on boot
systemctl --system daemon-reload
systemctl enable mongod.service
echo "Starting"
systemctl start mongod.service
@oliiix
Copy link

oliiix commented May 24, 2016

Finally mongodb 3.2 is running on ubuntu 16.04!! Thank you so much :)

@aliwatters
Copy link

Had to add Type=forking to the service section - but also now have 3.2 on 16.04

@davidlesches
Copy link

davidlesches commented Sep 20, 2016

👍 You are a god.

@mjunaid720
Copy link

Failed to start mongod.service: Unit mongod.service is not loaded properly: Invalid argument.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment