Skip to content

Instantly share code, notes, and snippets.

@robertlmullen74
Forked from ctavan/install_graylog.sh
Last active December 17, 2015 12:49
Show Gist options
  • Save robertlmullen74/5612657 to your computer and use it in GitHub Desktop.
Save robertlmullen74/5612657 to your computer and use it in GitHub Desktop.
#!/bin/bash
# WARNING: Don't use this in production since all passwords are kept at their default.
# mongodb
apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
echo -e "deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen\n" > /etc/apt/sources.list.d/mongodb-10gen.list
apt-get update
apt-get install -y mongodb-10gen
# elastic search
curl -LO https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.20.4.deb
dpkg -i elasticsearch-0.20.4.deb
# need this to fix some java errors
sudo apt-get install -f
export JAVA_HOME=/opt/java/jdk1.7.0_03
mkdir -p /opt/graylog2
curl -OL http://download.graylog2.org/graylog2-server/graylog2-server-0.11.0.tar.gz
tar -xvf graylog2-server-0.11.0.tar.gz
cp -r graylog2-server-0.11.0 /opt/graylog2
pushd /opt/graylog2
cp graylog2-server/elasticsearch.yml.example /etc/graylog2-elasticsearch.yml
ln -sf graylog2-server-0.11.0 graylog2-server
cp graylog2-server/graylog2.conf.example /etc/graylog2.conf
popd
cat <<EOF | mongo
use graylog2
db.addUser("grayloguser", "123")
exit
EOF
# graylog2 upstart script
curl -OL https://gist.github.com/robertlmullen74/5623420/raw/86b7e821e5647693feace765a097ce05e175f634/gistfile1.txt
sed 's#/opt/graylog2-server#/opt/graylog2/graylog2-server#' gistfile1.txt > /etc/init/graylog2-server.conf
# start graylog server
start graylog2-server
# graylog2 web interface
curl -OL http://download.graylog2.org/graylog2-web-interface/graylog2-web-interface-0.11.0.tar.gz
tar -xvf graylog2-web-interface-0.11.0.tar.gz
cp -r graylog2-web-interface-0.11.0 /opt/graylog2
pushd /opt/graylog2
ln -sf graylog2-web-interface-0.11.0 graylog2-web-interface
pushd graylog2-web-interface
apt-get install -y rubygems
gem install bundler
bundle install
popd
popd
#graylog needs ruby 1.9.1
sudo apt-get install ruby1.9.1 ruby1.9.1-dev
sudo ln -s /usr/bin/ruby1.9.1 /usr/bin/ruby
curl -OL http://production.cf.rubygems.org/rubygems/rubygems-2.0.3.tgz
tar xvzf rubygems-2.0.3.tgz
cd rubygems-2.0.3
sudo ruby setup.rb
sudo ln -s /usr/bin/gem1.9.1 /usr/bin/gem
sudo gem install bundler
cd /opt/graylog2/graylog2-web-interface
bundle install
# web-frontend run this after you're done, this will need to go into upstart at some point
# MONGOID_HOST=localhost MONGOID_PORT=27017 MONGOID_USERNAME=grayloguser MONGOID_PASSWORD=123 MONGOID_DATABASE=graylog2 /opt/graylog2/graylog2-web-interface/script/rails server -e production
# -> http://33.33.33.11:3000/
# logstash
#curl -OL http://semicomplete.com/files/logstash/logstash-1.1.0-monolithic.jar
#curl -OL http://logstash.net/docs/1.1.0/tutorials/10-minute-walkthrough/apache-parse.conf
#curl -OL http://logstash.net/docs/1.1.0/tutorials/10-minute-walkthrough/apache_log.1
# java -jar logstash-1.1.0-monolithic.jar agent -f apache-parse.conf
# nc localhost 3333 < apache_log.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment