Skip to content

Instantly share code, notes, and snippets.

@servercharlie
Last active September 22, 2017 13:22
Show Gist options
  • Save servercharlie/ce6621c779462a6a6a27196969b68b4e to your computer and use it in GitHub Desktop.
Save servercharlie/ce6621c779462a6a6a27196969b68b4e to your computer and use it in GitHub Desktop.
MongoDB setup on Ubuntu 16.10 (Yakkety Yak!)
sudo apt-get update
sudo apt-get install mongodb
sudo nano /etc/systemd/system/mongod.service
> paste the shit below
> change your 'User=' value to your preferred user
> configure it with your dbpath & logpath
> note: you can also use config file, https://docs.mongodb.com/manual/reference/configuration-options/
> to use config file, add '--config /path/to/ya/config/file/lol'
------ mongod.service - dont include this line ------
[Unit]
Description=High-performance, schema-free document-oriented database
After=network.target
[Service]
User=azureuser
ExecStart=/usr/bin/mongod --quiet --dbpath=/home/azureuser/mongod/db --logpath=/home/azureuser/mongod/mongod.log
[Install]
WantedBy=multi-user.target
------ end of file mate do not include this line too lol ------
> save & exit
> NOTE: THE FOLDER YOU SPECIFY ON DB PATH / LOGPATH MUST BE EXISTING.
> MAKE SURE TO CREATE THOSE FOLDERS FIRST BEFORE.
cd ~ && mkdir mongod && cd mongod && mkdir db
sudo systemctl start mongod
sudo systemctl status mongod
sudo systemctl enable mongod
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment