Advertisement
Guest User

Untitled

a guest
Nov 29th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. #!/bin/bash
  2. sudo apt-get update -y
  3. sudo apt-get upgrade -y
  4.  
  5. # Installing and configuring MySQL Server
  6. sudo apt-get install mysql-server mysql-client -y
  7. echo "Enter password for zabbix MYSQL user and press ENTER"
  8. read -s zabbix_password
  9. echo "Enter password for root MYSQL user and press ENTER"
  10. sudo mysql -u root -p<<QUERY
  11. CREATE DATABASE zabbix CHARACTER SET utf8 COLLATE utf8_general_ci;
  12. GRANT ALL PRIVILEGES ON zabbix.* TO zabbix@localhost IDENTIFIED BY '$zabbix_password' WITH GRANT OPTION;
  13. FLUSH PRIVILEGES;
  14. QUERY
  15.  
  16. # Installing apache2 and php
  17. sudo apt-get install apache2 -y
  18. sudo apt-get install php-mbstring php-bcmatch php-xml -y
  19. sudo service apache2 reload
  20. echo "Installing zabbix"
  21. wget http://repo.zabbix.com/zabbix/3.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.4-1+xenial_all.deb
  22. sudo dpkg -i zabbix-release_3.4-1+xenial_all.deb
  23.  
  24. # Installing Zabbix
  25. echo "Installing Zabbix server"
  26. sudo apt-get update -y
  27. sudo apt-get install zabbix-server-mysql -y
  28. sudo apt-get install zabbix-frontend-php -y
  29. cd /etc/apache2/conf-available/
  30. sudo sed -i -E "s/.*php_value date\.timezone .+/ php_value date.timezone Europe\/Moscow/" zabbix.conf
  31. sudo service apache2 reload
  32. cd /usr/share/doc/zabbix-server-mysql
  33. sudo gzip -d create.sql.gz
  34. sleep 1m
  35. sudo mysql -u zabbix -p$zabbix_password zabbix < create.sql
  36.  
  37. # Configuring Zabbix server
  38. echo "Configuring Zabbix server"
  39. cd /etc/zabbix/
  40. sudo sed -i -E "s/.*DBHost=.+/DBHost=localhost/" zabbix_server.conf
  41. sudo sed -i -E "s/.*DBName=.+/DBName=zabbix/" zabbix_server.conf
  42. sudo sed -i -E "s/.*DBUser=.+/DBUser=zabbix/" zabbix_server.conf
  43. sudo sed -i -E "s/.*DBPassword=.+/DBPassword=$zabbix_password/" zabbix_server.conf
  44. sudo service zabbix-server start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement