软件环境
Centos7.3
LAMP
Zabbix 3.2
1. Installing repository configuration package
Install the repository configuration package. This package contains yum (software package manager) configuration files.
# rpm -ivh http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm
Now you are ready to install Zabbix server with MySQL or server with PostreSQL, agent and proxy.
2. Installing apache and php
[root@localhost ~]# yum -y install httpd php php-mysql php-mbstring php-gd php-bcmath php-ldap php-xml
2.1 配置php时区参数
(a) php.ini
(b) /etc/httpd/conf.d/zabbix.conf
php_value date.timezone Asia/Shanghai
2.2 启动web服务
[root@localhost ~]# systemctl start httpd.service
# systemctl enable httpd.service
3. Installing mariadb
# yum -y install mariadb mariadb-server
# systemctl start mariadb.service
# systemctl enable mariadb.service
4. Installing Zabbix server and web packages
# yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent
4.1 Creating initial mariadb database
# mysql_secure_installation
# mysql -u root -p <root_password>
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> create user 'zabbix'@'localhost' identified by 'zabbix_password';
mysql> create user 'zabbix'@'192.168.1.%' identified by 'zabbix_password';
mysql> grant all on zabbix.* to ‘zabbix’@‘localhost';
mysql> grant all on zabbix.* to ’zabbix‘@‘192.168.1.%’;
mysql> quit
4.2 Now import initial schema and data. Make sure to insert correct version for 3.2.*. You will be prompted to enter your newly created password.
In order to check the version you have in your package, use the following command:
# rpm -q zabbix-server-mysql
# zcat /usr/share/doc/zabbix-server-mysql-3.2.*/create.sql.gz | mysql -u zabbix -p -D zabbix
5. Database configuration for Zabbix server
Edit server host name, user and password in zabbix_server.conf as follows, where DBPassword is the password you've set creating initial database:
# vi /etc/zabbix/zabbix_server.conf
DBHost=localhost ##database host name
DBName=zabbix ##database name
DBUser=zabbix ##database user name
DBPassword=<zabbix_password> ##database user password
5.1Starting Zabbix server
It's time to start Zabbix server process and make it start at system boot:
# systemctl start zabbix-server
# systemctl enable zabbix-server
5.2 PHP configuration for Zabbix web
Apache configuration file for Zabbix frontend is located in /etc/httpd/conf.d/zabbix.conf. Some PHP settings are already configured.
But it's necessary to uncomment the "date.timezone" setting and set the right timezone for you.
php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
php_value always_populate_raw_post_data -1
# php_value date.timezone Europe/Riga
5.3 SELinux configuration
Having SELinux status enabled in enforcing mode, you need to execute the following command to enable successful connection of Zabbix frontend to the server:
# setsebool -p httpd_can_network_connect on
# setsebol -p http_can_connect_zabbix on
# setsebool -p -p zabbix_can_network on
5.4 Firwall configuration
#f irewall-cmd --permanent --add-port=80/tcp
# firewall-cmd --permanent --add-port=443/tcp
# firewall-cmd --permanent --add-port=10050-10052/tcp
# firewall-cmd --reload
As frontend and SELinux configuration is done, you need to restart Apache web server:
# systemctl restart httpd
# systemctl restart zabbix-server
# systemctl restart zabbix-agent
5.5 Installing and configuration Zabbix-web
webUI site: http://IP/zabbix
username:Admin
password: zabbix
Zabbix web configuration file
# cat /etc/zabbix/web/zabbix.config.php