Advertisement
opexxx

garylog-bootstrap.sh

Jul 8th, 2014
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.77 KB | None | 0 0
  1. #!/bin/bash -eu
  2.  
  3. release_src=https://github.com/downloads/Graylog2
  4. graylog2_server=graylog2-server-0.9.4p1.tar.gz
  5. graylog2_web_interface=graylog2-web-interface-0.9.4p2.tar.gz
  6. graylog2_base=/var/graylog2
  7. graylog2_collection_size=650000000
  8.  
  9. sudo apt-get install -y python-software-properties
  10. sudo add-apt-repository 'deb http://downloads.mongodb.org/distros/ubuntu 10.4 10gen'
  11. sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
  12. sudo apt-get update
  13.  
  14. env='DEBIAN_FRONTEND=noninteractive'
  15. for pkg in wget build-essential make rrdtool openjdk-6-jre ruby1.8 rubygems rake libopenssl-ruby libmysqlclient-dev ruby-dev libapache2-mod-passenger postfix mongodb-stable mysql-server
  16. do
  17.   sudo $env apt-get install -y $pkg
  18. done
  19.  
  20. sudo mkdir -pv $graylog2_base/src
  21.  
  22. cd $graylog2_base/src
  23.  
  24. sudo wget --no-check-certificate $release_src/graylog2-server/$graylog2_server -O $graylog2_server
  25. sudo tar -xvf $graylog2_server
  26. folder=`echo $graylog2_server | sed 's/.tar.gz//'`
  27. sudo ln -sf $graylog2_base/src/$folder $graylog2_base/server
  28.  
  29. sudo wget --no-check-certificate $release_src/graylog2-web-interface/$graylog2_web_interface -O $graylog2_web_interface
  30. sudo tar -xvf $graylog2_web_interface
  31. folder=`echo $graylog2_web_interface | sed 's/.tar.gz//'`
  32. sudo ln -sf $graylog2_base/src/$folder $graylog2_base/web
  33.  
  34. sudo gem install rubygems-update
  35. sudo /var/lib/gems/1.8/bin/update_rubygems
  36. sudo gem install bundler
  37.  
  38. cd $graylog2_base/server
  39.  
  40. sudo mv -f graylog2.conf.example graylog2.conf
  41. sudo sed -e "s/mongodb_useauth = true/mongodb_useauth = false/" -i graylog2.conf
  42. sudo sed -e "s/messages_collection_size = 50000000/messages_collection_size = $graylog2_collection_size/" -i graylog2.conf
  43. sudo ln -sf $graylog2_base/server/graylog2.conf /etc/graylog2.conf
  44.  
  45. cd bin && sudo ./graylog2ctl start
  46.  
  47. cd $graylog2_base/web
  48.  
  49. sudo bundle install
  50.  
  51. sudo sed -e "s/password: yourpass/password:/" -i config/database.yml
  52. fqdn=`hostname --fqdn`
  53. sudo sed -e "s/external_hostname: \"your-graylog2.example.org\"/external_hostname: \"$fqdn\"/" -i config/general.yml
  54.  
  55. sudo chown -R nobody:nogroup $graylog2_base
  56.  
  57. env='RAILS_ENV=production'
  58. sudo -u nobody rake db:create $env
  59. sudo -u nobody rake db:migrate $env
  60.  
  61. cd /etc/apache2
  62.  
  63. echo "
  64. <VirtualHost *:80>
  65. DocumentRoot $graylog2_base/web/public
  66. <Directory $graylog2_base/web/public>
  67. Allow from all
  68. Options -MultiViews
  69. </Directory>
  70. ErrorLog /var/log/apache2/error.log
  71. LogLevel warn
  72. CustomLog /var/log/apache2/access.log combined
  73. </VirtualHost>
  74. " | sudo tee sites-available/graylog2
  75.  
  76. sudo a2ensite graylog2
  77. sudo a2dissite default
  78.  
  79. sudo sed -e "s/APACHE_RUN_USER=www-data/APACHE_RUN_USER=nobody/" -i envvars
  80. sudo sed -e "s/APACHE_RUN_GROUP=www-data/APACHE_RUN_GROUP=nogroup/" -i envvars
  81.  
  82. sudo /etc/init.d/apache2 restart
  83.  
  84. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement