Skip to content

Instantly share code, notes, and snippets.

@Titiaiev
Last active October 9, 2020 11:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Titiaiev/5af58cf194f5412665f201e40f6668b9 to your computer and use it in GitHub Desktop.
Save Titiaiev/5af58cf194f5412665f201e40f6668b9 to your computer and use it in GitHub Desktop.
Mongodb
#! /bin/bash
wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add - \
&& touch /etc/apt/sources.list.d/mongodb-org-4.4.list \
&& echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list \
&& sudo apt-get update \
&& sudo apt-get install -y mongodb-org \
&& sudo mkdir /var/lib/mongodb /var/log/mongodb /var/run/mongodb \
&& sudo chown -R mongodb:mongodb /var/lib/mongodb /var/log/mongodb /var/run/mongodb \
&& sudo touch /etc/mongod.conf \
&& sudo wget https://gist.githubusercontent.com/Titiaiev/5af58cf194f5412665f201e40f6668b9/raw/98dd724c349e46cab521a5e626fa8247019b6a87/mongod.conf > /etc/mongod.conf \
&& sudo systemctl start mongod \
&& sudo systemctl enable mongod
# mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
# Where and how to store data.
storage:
dbPath: /var/lib/mongodb
journal:
enabled: true
# engine:
# wiredTiger:
# how the process runs
processManagement:
fork: true # fork and run in background
pidFilePath: /var/run/mongodb/mongod.pid # location of pidfile
timeZoneInfo: /usr/share/zoneinfo
# network interfaces
net:
port: 27017
bindIp: 127.0.0.1 # Enter 0.0.0.0,:: to bind to all IPv4 and IPv6 addresses or, alternatively, use the net.bindIpAll setting.
#security:
#operationProfiling:
#replication:
#sharding:
## Enterprise-Only Options
#auditLog:
#snmp:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment