centos部署zabbix4.4

rpm -ivh https://mirrors.aliyun.com/zabbix/zabbix/4.4/rhel/7/x86_64/zabbix-release-4.4-1.el7.noarch.rpm

yum repolist

yum -y install zabbix-agent zabbix-get zabbix-sender zabbix-server-mysql zabbix-web zabbix-web-mysql

yum -y install mariadb-server mariadb-client

 

vim /etc/my.cnf.d/server.cnf

# this is only for the mysqld standalone daemon
[mysqld]
skip_name_resolve = ON #跳过主机名解析
innodb_file_per_table = ON #开启独立表空间
innodb_buffer_pool_size = 256M #缓存池大小
max_connections = 2000 #最大连接数
log-bin = master-log #开启二进制日志

 systemctl restart mariadb

mysql_secure_installation

mysql -uroot -p

 create database zabbix character set 'utf8';

grant all on zabbix.* to 'zbxuser'@'192.168.66.%' identified by 'zabbix';

grant all on zabbix.* to 'zbxuser'@'localhost' identified by 'zabbix';

flush privileges;

 

rpm -ql zabbix-server-mysql

[root@s0 ~]# vim /usr/share/doc/zabbix-server-mysql-4.4.10/create.sql
[root@s0 ~]# mysql -uzbxuser -pzabbix < /usr/share/doc/zabbix-server-mysql-4.4.10/create.sql


ListenPort=10051

### Option: SourceIP
# Source IP address for outgoing connections.
#
# Mandatory: no
# Default:
SourceIP=192.168.66.66

 

zabbix-server配置文件中数据库的相关设置

SourceIP=192.168.66.66

ListenPort=10051

DBHost=192.168.66.66

DBName=zabbix

DBUser=zbxuser

DBPassword=zabbix


DBPort=3306

 

主要的配置选项如下:

[root@s0 ~]# cat /etc/zabbix/zabbix_server.conf | grep -v '#' | grep -v '^$'
ListenPort=10051
SourceIP=192.168.66.66
LogFile=/var/log/zabbix/zabbix_server.log
LogFileSize=0
PidFile=/var/run/zabbix/zabbix_server.pid
SocketDir=/var/run/zabbix
DBHost=192.168.66.66
DBName=zabbix
DBUser=zbxuser
DBPassword=zabbix
DBPort=3306
SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
Timeout=4
AlertScriptsPath=/usr/lib/zabbix/alertscripts
ExternalScripts=/usr/lib/zabbix/externalscripts
LogSlowQueries=3000
StatsAllowedIP=127.0.0.1

 

确保mariadb和zabbix-server都已启动

systemctl start mariadb zabbix-server

 

修改zabbix-web配置

vim /etc/php.ini
date.timezone = Asia/Shanghai

 至此可以启动httpd服务,打开http://192.168.66.66/zabbix

zabbix相关的包 4.4.7或10版本的有问题,建议安装4.4.1版本的所有相关包。可在阿里云镜像中下载后使用yum local install

打开web,输入db名字、用户名密码

Pre-installation summary

Please check configuration parameters. If all is correct, press "Next step" button, or "Back" button to change configuration parameters.

  • Database type
    MySQL
  • Database server
    192.168.66.66
  • Database port
    default
  • Database name
    zabbix
  • Database user
    zbxuser
  • Database password
    ******
  •  
     
  • Zabbix server
    192.168.66.66
  • Zabbix server port
    10051
  • Zabbix server name
    zabbix

至此已完成安装。接下来可以添加监控设备和监控项了

 

 

## zabbix客户端的配置

vim   /etc/zabbix/zabbix_agentd.conf

Server=192.168.66.66  #服务端ip

ListenPort=10050  #监听端口

ListenIP=0.0.0.0  #允许所有ip

ServerActive=192.168.66.66  主动监控时的服务器

Hostname=s0  能被server识别的名称

 

posted @ 2020-10-23 14:21  黑剑石清  阅读(99)  评论(0编辑  收藏  举报