'配置zabbix数据库'
[root@yxr src]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.22 MySQL Community Server (GPL)
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
mysql> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.08 sec) '创建zabbix并支持中文'
mysql> show databases; (查看存在哪些数据库)
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
| zabbix |
+--------------------+
5 rows in set (0.11 sec)
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix123!'; '授权zabbix用户在数据库本机上登录访问所有数据库'
Query OK, 0 rows affected, 2 warnings (0.11 sec)
mysql> grant all privileges on zabbix.* to zabbix@127.0.0.1 identified by 'zabbix123!';
Query OK, 0 rows affected, 1 warning (0.04 sec)
'注意:mysql服务进程启动时会读取mysql库中的所有授权表至内存中:
1.grant 或revoke等执行权限操作会保存与表中,mysql的服务进程会自动重读授权表,并更新至内存中
2.对于不能够或不能及时重读授权表的命令,可手动让mysql的服务进程重读授权表'
mysql> flush privileges;
Query OK, 0 rows affected (0.16 sec)
mysql> exit
Bye
[root@yxr ~]# cd /usr/src/zabbix-3.4.12/database/mysql/
[root@yxr mysql]# ls
data.sql images.sql schema.sql
[root@yxr mysql]# mysql -uzabbix -pzabbix123! zabbix --enable-agent \
> --with-mysql \
> --with-net-snmp \
> --with-libcurl \
> --with-libxml2
[root@yxr zabbix-3.4.12]# make install
zabbix服务端配置
[root@yxr ~]# ls /usr/local/etc/
zabbix_agentd.conf zabbix_server.conf
zabbix_agentd.conf.d zabbix_server.conf.d
[root@yxr ~]# vim /usr/local/etc/zabbix_server.conf
'搜索/DBPassword'
### Option: DBPassword
# Database password. Ignored for SQLite.
# Comment this line if no password is used.
#
# Mandatory: no
# Default:
# DBPassword=
DBPassword=zabbix123! '设置zabbix数据库连接密码'
'启动zabbix_server和zabbix_agentd'
[root@yxr ~]# zabbix_server
[root@yxr ~]# zabbix_agentd
[root@yxr ~]# ss -antl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 *:22 *:*
LISTEN 0 100 127.0.0.1:25 *:*
LISTEN 0 128 *:10050 *:*
LISTEN 0 128 *:10051 *:*
LISTEN 0 128 127.0.0.1:9000 *:*
LISTEN 0 128 :::80 :::*
LISTEN 0 128 :::22 :::*
LISTEN 0 100 ::1:25 :::*
LISTEN 0 80 :::3306 :::*
zabbix服务端web界面安装与配置
'修改/etc/php.ini的配置并重启php-fpm'
[root@yxr ~]# sed -ri 's/(post_max_size =).*/\1 16M/g' /etc/php.ini
[root@yxr ~]# sed -ri 's/(max_execution_time =).*/\1 300/g' /etc/php.ini
[root@yxr ~]# sed -ri 's/(max_input_time =).*/\1 300/g' /etc/php.ini
[root@yxr ~]# sed -i '/;date.timezone/a date.timezone = Asia/Shanghai' /etc/php.ini
[root@yxr ~]# service php-fpm restart
Gracefully shutting down php-fpm . done
Starting php-fpm done
[root@yxr ~]# cd /usr/src/zabbix-3.4.12/
[root@yxr zabbix-3.4.12]# ls
aclocal.m4 configure Makefile.am
AUTHORS configure.ac Makefile.in
bin COPYING man
build database misc
ChangeLog depcomp missing
compile frontends NEWS
conf include README
config.guess INSTALL sass
config.log install-sh src
config.status m4 upgrades
config.sub Makefile
[root@yxr zabbix-3.4.12]# mkdir /usr/local/apache/htdocs/zabbix
[root@yxr zabbix-3.4.12]# cp -a frontends/php/* /usr/local/apache/htdocs/zabbix/
[root@yxr zabbix-3.4.12]# chown -R apache.apache /usr/local/apache/htdocs/