SHARE
TWEET

Untitled

a guest Aug 12th, 2016 119 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. #****************************************/
  4. #* @Project:    wmc_serverscripts       */
  5. #* @Author:     Joel Kuder              */
  6. #* @Filename:   wmc_srv_install_brokerstar*/
  7. #* Aenderung:   08.06.2016              */
  8. #****************************************/
  9.  
  10. ICH=`whoami`;
  11. if [[ $ICH  != root ]];then
  12.     echo "Sorry Bro, you are not root"
  13.     exit 1
  14. fi
  15.  
  16. echo "----------------- ADD NEW REPO's -----------------"
  17. apt-get install --allow-unauthenticated -y apt-transport-https
  18. echo -e "deb http://packages.dotdeb.org jessie all\n deb-src http://packages.dotdeb.org jessie all\n" > /etc/apt/sources.list.d/dotdeb.list
  19. echo -e "deb http://www.d7031.de/debian jessie-experimental main\n" > /etc/apt/sources.list.d/http2.list
  20. echo -e "deb http://dl.google.com/linux/mod-pagespeed/deb/ stable main \n" > /etc/apt/sources.list.d/mod-pagespeed.list
  21. echo -e "deb https://deb.nodesource.com/node_4.x jessie main\n deb-src https://deb.nodesource.com/node_4.x jessie main\n" > /etc/apt/sources.list.d/nodesource.list
  22. wget https://www.dotdeb.org/dotdeb.gpg
  23. apt-key add dotdeb.gpg
  24.  
  25. apt-get update && apt-get dist-upgrade --allow-unauthenticated
  26. echo -e "______________________________________________________\n\n"
  27.  
  28.  
  29. echo "----------------- wkhtmltopdf -----------------"
  30. cd /tmp/
  31. wget https://github.com/h4cc/wkhtmltopdf-amd64/archive/0.12.3.tar.gz
  32. tar -zxvf 0.12.3.tar.gz wkhtmltopdf-amd64-0.12.3/bin/wkhtmltopdf-amd64
  33. mv wkhtmltopdf-amd64-0.12.3/bin/wkhtmltopdf-amd64 /usr/local/bin/wkhtmltopdf
  34. rm 0.12.3.tar.gz
  35. echo -e "______________________________________________________\n\n"
  36.  
  37. echo "----------------- Install required Packages for Brokerstar -----------------"
  38. apt-get update && apt-get dist-upgrade --allow-unauthenticated && apt-get install --allow-unauthenticated -y sudo curl build-essential node-uglify  apache2  libapache2-mod-php7.0 node-uglify mysql-client vim-nox git apachetop mytop vnstat htop dnstop iftop ssh memcached libmemcached-tools openssh-server xvfb fontconfig libxrender1 libfontconfig1 pdftk ttf-mscorefonts-installer php7.0 php7.0-apcu php7.0-cli php7.0-bz2 php7.0-common  php7.0-curl php7.0-gd php7.0-intl php7.0-imap php7.0-json php7.0-mysql php7.0-readline php7.0-opcache php7.0-soap php7.0-bcmath php7.0-xml php7.0-zip php7.0-mbstring php7.0-memcached
  39. echo -e "______________________________________________________\n\n"
  40.  
  41.  
  42. echo "----------------- write php.ini configs -----------------"
  43. echo -e "post_max_size=100M \n upload_max_filesize=100M \n date.timezone = \"Europe/Zurich\" \n memory_limit = 512M \n max_input_vars = 10000 \n " >> /etc/php/7.0/apache2/php.ini
  44.  
  45. echo "----------------- enable new apache modules -----------------"
  46. a2enmod http2
  47. a2enmod ssl
  48. a2enmod rewrite
  49. a2enmod expires
  50. a2enmod proxy_http
  51. a2enmod proxy_http2
  52. a2enmod proxy
  53.  
  54. echo "----------------- Install Composer -----------------"
  55. cd /tmp/
  56. curl -sS https://getcomposer.org/installer | php
  57. mv composer.phar /usr/local/bin/composer
  58.  
  59. echo "----------------- Install nodejs -----------------"
  60. curl -sL https://deb.nodesource.com/setup_4.x | bash -
  61. apt-get install --allow-unauthenticated -y nodejs
  62.  
  63. echo "----------------- Install UglifyCSS -----------------"
  64. cd /usr/bin/
  65. git clone git://github.com/fmarcia/UglifyCSS.git
  66. mv UglifyCSS /usr/local/bin/uglifycss
  67.  
  68. echo "----------------- Adduser WMC ------------------------"
  69. echo "-> für ssh dev zugang und apache user"
  70. PASS=$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c12)
  71. adduser --disabled-password wmc
  72. echo "wmc:".${PASS} | chpasswd
  73.  
  74. echo "----------------- Adduser bash_profile ------------------------"
  75. mkdir /home/wmc
  76. cp /opt/wmc_serverscripts/src/debian/root/.bash_profile /home/wmc/.bash_profile
  77. cp /opt/wmc_serverscripts/src/debian/root/.dircolorsrc /home/wmc/.dircolorsrc
  78. chown wmc:wmc /home/wmc/.bash_profile
  79. chown wmc:wmc /home/wmc/.dircolorsrc
  80.  
  81.  
  82. echo "----------------- Gebe volle SUDO rechte an WMC ------"
  83. echo "wmc ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
  84. service sudo restart
  85.  
  86. echo "----------------- ändere Apache user auf wmc ------"
  87. echo -e "\n\nexport APACHE_RUN_USER=wmc\nexport APACHE_RUN_GROUP=wmc\n" >> /etc/apache2/envvars
  88. service apache2 restart
  89.  
  90. echo "----------------- ändere Apache user auf wmc ------"
  91. cp /opt/wmc_serverscripts/src/default_html/var/www/html/* /var/www/html
  92. chown wmc:wmc /var/www -R
  93.  
  94.  
  95. echo "----------------- ssh key für wmc ------"
  96. #GIT
  97. mkdir /home/wmc/.ssh
  98. ssh-keygen -t rsa -b 4096 -C wmc@webbs3 -f /home/wmc/.ssh/id_rsa
  99. cat /home/wmc/.ssh/id_rsa.pub
  100. chown wmc:wmc /home/wmc/.ssh -R
  101.  
  102.  
  103. echo "----------------- log ordner für wmc ------"
  104. mkdir /var/log/wmc
  105. chown wmc:wmc /var/log/wmc
  106.  
  107. echo "----------------- add crons ------"
  108. #write out current crontab
  109. crontab -l > mycron
  110. #echo new cron into cron file
  111. echo "*   *   *   *   *   git -C "/opt/wmc_serverscripts/" pull" >> mycron
  112. echo "*   *   *   *   *   git -C "/opt/zertifikate/" pull" >> mycron
  113. #install new cron file
  114. crontab mycron
  115. rm mycron
  116.  
  117. echo "----------------- add wmc crons ------"
  118. #write out current crontab
  119. crontab -uwmc -l > mycron
  120. #echo new cron into cron file
  121. echo "*   *   *   *   *   SUFFIX=`date +\%Y-\%m-\%d`; php -f /opt/wmc_serverscripts/src/srv_ind/bs00/create_instance.php >> /var/log/wmc/bs_${SUFFIX}-cron.log 2>&1" >> mycron
  122. #install new cron file
  123. crontab -uwmc mycron
  124. rm mycron
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top