Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- sudo apt-get update -y
- sudo apt-get upgrade -y
- # Installing and configuring MySQL Server
- sudo apt-get install mysql-server mysql-client -y
- echo "Enter password for zabbix MYSQL user and press ENTER"
- read -s zabbix_password
- echo "Enter password for root MYSQL user and press ENTER"
- sudo mysql -u root -p<<QUERY
- CREATE DATABASE zabbix;
- GRANT ALL PRIVILEGES ON zabbix.* TO zabbix@localhost IDENTIFIED BY '$zabbix_password' WITH GRANT OPTION;
- FLUSH PRIVILEGES;
- QUERY
- # Installing apache2 and php
- sudo apt-get install apache2 -y
- sudo apt-get install php-mbstring php-bcmatch php-xml -y
- sudo service apache2 reload
- echo "Installing zabbix"
- wget http://repo.zabbix.com/zabbix/3.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.4-1+xenial_all.deb
- sudo dpkg -i zabbix-release_3.4-1+xenial_all.deb
- # Installing Zabbix
- sudo apt-get update
- sudo apt-get install zabbix-server-mysql -y
- sudo apt-get install zabbix-frontend-php -y
- cd /etc/apache2/conf-available/
- sudo sed -i -E "s/.*php_value date\.timezone .+/ php_value date.timezone Europe\/Moscow/" zabbix.conf
- sudo service apache2 reload
- cd /usr/share/doc/zabbix-server-mysql
- sudo gzip -d create.sql.gz
- sleep 1m
- mysql -u zabbix -p$zabbix_password zabbix < create.sql
- # Configuring Zabbix server
- cd /etc/zabbix/
- sudo sed -i -E "s/.*DBHost=.+/DBHost=localhost/" zabbix_server.conf
- sudo sed -i -E "s/.*DBName=.+/DBName=zabbix/" zabbix_server.conf
- sudo sed -i -E "s/.*DBUser=.+/DBUser=zabbix/" zabbix_server.conf
- sudo sed -i -E "s/.*DBPassword=.+/DBPassword=$zabbix_password/" zabbix_server.conf
- sudo service zabbix-server start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement