安装MariaDB
1 2 3 4 5 6
| yum install mariadb-server mariadb systemctl enable mariadb.service systemctl start mariadb.service mysql_secure_installation firewall-cmd --permanent --zone=public --add-service=mysql firewall-cmd --reload
|
创建zabbix数据库及帐号
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| [root@localhost create]# mysql -uroot -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 12 Server version: 5.5.41-MariaDB MariaDB Server Copyright (c) 2000, 2014, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> create database zabbix character set utf8; Query OK, 1 row affected (0.00 sec) MariaDB [(none)]> create database zabbix character set utf8; Query OK, 1 row affected (0.00 sec) MariaDB [(none)]> grant all privileges on zabbix.* to 'zabbix'@'localhost' identified by 'zabbix'; Query OK, 0 rows affected (0.00 sec)
|
添加zabbix仓库配置
rpm -ivh http://repo.zabbix.com/zabbix/2.4/rhel/7/x86_64/zabbix-release-2.4-1.el7.noarch.rpm
安装并启用zabbix server
1
| yum install -y zabbix-server-mysql zabbix-web-mysql
|
启用Apache httpd
1 2 3 4
| systemctl enable httpd.service systemctl start httpd.service firewall-cmd --permanent --zone=public --add-service=http firewall-cmd --reload
|
初始化zabbix数据库
1 2 3 4
| cd /usr/share/doc/zabbix-server-mysql-2.4.4/create mysql -uroot -pzabbix zabbix < schema.sql mysql -uroot -pzabbix zabbix < images.sql mysql -uroot -zabbixp zabbix < data.sql
|
修改zabbix前端的PHP配置
zabbix前端的Apache配置文件为/etc/httpd/conf.d/zabbix.conf。需要去掉# php_value date.timezone Europe/Riga
的井号#
,并把Europe/Riga
改成服务器所在的时区,例如Asia/Shanghai
。修改完后重启Apache web服务器:systemctl restart httpd
修改zabbix配置文件
按如下说明配置zabbix_server.conf
1 2 3 4 5
| # vi /etc/zabbix/zabbix_server.conf DBHost=localhost DBName=zabbix DBUser=zabbix DBPassword=zabbix
|
配置完重启zabbix server:
1 2
| systemctl stop zabbix-server systemctl start zabbix-server
|
systemctl restart zabbix-server命令执行后,不能启动zabbix-server,故需要先stop再start zabbix-server。
使用浏览器完成剩余配置
使用浏览器打开 http://server_ip/zabbix,其中server_ip要替换为服务器实际使用的IP地址,按照提示完成安装。安装完成后默认的用户名是:admin,密码是zabbix。