官网www.zabbix.com
rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
yum clean all
yum -y install zabbix-server-mysql zabbix-agent
yum -y install centos-release-scl
vim /etc/yum.repos.d/zabbix.repo
[zabbix-frontend]
name=Zabbix Official Repository frontend - $basearch
baseurl=http://repo.zabbix.com/zabbix/5.0/rhel/7/$basearch/frontend
enabled=1 #原本这里是0改为1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
yum -y install zabbix-web-mysql-scl zabbix-nginx-conf-scl
下载yum源的rpm包
yum install -y https://dev.mysql.com/get/mysql80-community-release-el7-7.noarch.rpm
永久修改下载版本
yum -y install yum-utils //安装工具
yum-config-manager --disable mysql80-community //关闭8.0
yum-config-manager --enable mysql57-community //打开5.7
安装mysql
yum -y groupinstall "Development Tools"
yum -y install mysql-community-server
systemctl start mysqld //首次启动初始化mysql
修改密码策略
echo "validate-password=off" >> /etc/my.cnf
systemctl restart mysqld
修改密码
grep "password" /var/log/mysqld.log //日志中查找初始密码
mysqladmin -p'旧密码' password '0'
Make sure you have database server up and running.
在数据库主机上运行以下代码。
mysql -uroot -p0
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> create user zabbix@localhost identified by 'password';
mysql> grant all privileges on zabbix.* to zabbix@localhost;
mysql> flush privileges;
mysql> set global log_bin_trust_function_creators = 1;
mysql> quit;
导入初始架构和数据,系统将提示您输入新创建的密码。
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz |mysql -uzabbix -p0 zabbix
Disable log_bin_trust_function_creators option after importing database schema.
mysql -uroot -ppassword
mysql> set global log_bin_trust_function_creators = 0;
mysql> quit;
vim /etc/zabbix/zabbix_server.conf
DBPassword=password
vim /etc/opt/rh/rh-nginx116/nginx/conf.d/zabbix.conf
# listen 80; #取消注释
# server_name example.com;
编辑配置文件 /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
listen.acl_users = apache,nginx
; php_value[date.timezone] = Asia/Shanghai //取消注释
修改zabbix的nginx文件
vim /etc/opt/rh/rh-nginx116/nginx/nginx.conf
将里面的server块删掉
启动Zabbix server和agent进程,并为它们设置开机自启:
# systemctl restart zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm
# systemctl enable zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm
rh-nginx116-nginx //启动nginx
rh-php72-php-fpm //启动php-fpm
数据库
mysql所在服务器
port端口0==默认端口
name数据库姓名
user数据库用户名
password数据库密码
host:主机名字
port:zabbix的端口
name:与主机名一致
默认账号密码:
账号:Admin
密码:zabbix
server 10051
proxy 10051
agent 10050