一:安装mysql
1.查找是否有mysql安装
rpm -qa | grep -i mysql
rpm -qa | grep -i mariadb
2.安装依赖
yum -y install libaio
yum -y install net-tools
yum -y install perl
3.安装mysql 5.7
wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql-community-server
4.service mysqld start 启动
5.grep password /var/log/mysqld.log 查看临时密码
6.mysql -u root -p
mysql
set password = password("xxxxxx");
create database zabbix character set utf8 collate utf8_bin;
create user zabbix@'%' identified by 'xxxxx';
grant all privileges on zabbix.* to zabbix@'%';
flush privileges;
二.安装 zabbix server
1.rpm安装
rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm
yum clean all
yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent
2.vim /etc/httpd/conf.d/zabbix.conf
php_value date.timezone Europe/Riga 这一段注释放开并且把后面的时区改为 Asia/Shanghai
3.vim /etc/zabbix/zabbix_server.conf
配置数据库相关信息
DBHost=
DBName=
DBUser=
DBPassword=
4.zabbix建表
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
5.启动服务
systemctl restart zabbix-server zabbix-agent httpd
systemctl enable zabbix-server zabbix-agent httpd
输入服务器地址
http://服务器ip/zabbix
配置好zabbix服务端ip、端口和数据库连接信息即可
三.安装 zabbix agent
rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm
yum clean all
yum install zabbix-agent
配置zabbix server的地址
vim /etc/zabbix/zabbix_agentd.conf
Server=101.11.210.156
ServerActive=101.11.210.156
systemctl restart zabbix-agent