[root@test ~]# systemctl restart mariadb.service [root@test ~]# mysqladmin -u root password '123456' [root@test ~]# mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 9 Server version: 10.3.11-MariaDB MariaDB Server
Copyright (c) 2000, 2018, 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 collate utf8_bin; Query OK, 1 row affected (0.001 sec)
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by '123456'; Query OK, 0 rows affected (0.000 sec)
MariaDB [(none)]> quit Bye
导入初始架构和数据 [root@test ~]# zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql -uzabbix -p zabbix Enter password:
d. 为Zabbix server配置数据库 编辑配置文件 /etc/zabbix/zabbix_server.conf
1 2
[root@test ~]# vim /etc/zabbix/zabbix_server.conf DBPassword=123456
e. 为Zabbix前端配置PHP 编辑配置文件 /etc/php-fpm.d/zabbix.conf
1 2
[root@test ~]# vim /etc/php-fpm.d/zabbix.conf php_value[date.timezone] = Asia/Shanghai
f. 启动Zabbix server和agent进程 启动Zabbix server和agent进程,并为它们设置开机自启:
1 2 3 4 5 6 7
[root@test ~]# systemctl restart zabbix-server zabbix-agent httpd php-fpm [root@test ~]# systemctl enable zabbix-server zabbix-agent httpd php-fpm [root@test ~]# netstat -ntlp #zabbix_server的端口是10051 Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:10051 0.0.0.0:* LISTEN 2106/zabbix_server tcp6 0 0 :::10051 :::* LISTEN 2106/zabbix_server