Skip to content

Instantly share code, notes, and snippets.

@ross-newman
Last active April 19, 2021 05:08
Show Gist options
  • Save ross-newman/1564323decea260c9ff0ca07990c1bbf to your computer and use it in GitHub Desktop.
Save ross-newman/1564323decea260c9ff0ca07990c1bbf to your computer and use it in GitHub Desktop.
#!/bin/bash -e
## Setup as per https://docs.graylog.org/en/4.0/pages/installation/os/ubuntu.html
## Dependancies
apt-get update && sudo apt-get upgrade -y
apt-get install apt-transport-https openjdk-8-jre-headless uuid-runtime pwgen -y --no-install-recommends
add-apt-repository universe
apt-get update && sudo apt-get upgrade -y
apt-get install apt-transport-https openjdk-8-jre-headless uuid-runtime pwgen -y --no-install-recommends
##MongoDB
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4
echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list
apt-get update
apt-get install -y mongodb-org -y --no-install-recommends
##Enable MongoDB
systemctl daemon-reload
systemctl enable mongod.service
systemctl restart mongod.service
systemctl --type=service --state=active | grep mongod
## Elastic Search
wget -q https://artifacts.elastic.co/GPG-KEY-elasticsearch -O myKey
apt-key add myKey
echo "deb https://artifacts.elastic.co/packages/oss-7.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-7.x.list
apt-get update && sudo apt-get install elasticsearch-oss
tee -a /etc/elasticsearch/elasticsearch.yml > /dev/null <<EOT
cluster.name: graylog
action.auto_create_index: false
EOT
## Elastic Search enable
systemctl daemon-reload
systemctl enable elasticsearch.service
systemctl restart elasticsearch.service
systemctl --type=service --state=active | grep elasticsearch
## Install Graylog
wget https://packages.graylog2.org/repo/packages/graylog-4.0-repository_latest.deb
dpkg -i graylog-4.0-repository_latest.deb
apt-get update && sudo apt-get install graylog-server graylog-enterprise-plugins graylog-integrations-plugins graylog-enterprise-integrations-plugins
apt-get install graylog-server
## Setup password
echo -n yourpassword | shasum -a 256
echo -n "Enter Password: " && head -1 </dev/stdin | tr -d '\n' | sha256sum | cut -d" " -f1
nano /etc/graylog/server/server.conf
echo "Finished setup"
## Graylog Enable
systemctl daemon-reload
systemctl enable graylog-server.service
systemctl start graylog-server.service
systemctl --type=service --state=active | grep graylog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment