官网文档5.0LTS
https://www.zabbix.com/cn/download?zabbix=5.0&os_distribution=centos&os_version=7&db=mysql&ws=nginx
关闭防火墙或者允许端口通过都可以
firewall-cmd --zone=public --add-port=10051/tcp --permanent # 开放Zabbix-server默认端口10051
systemctl disable firewalld #永久关闭防火墙
关闭selinux
vim /etc/selinux/config
SELINUX=
disabled
添加zabbix源
rpm -Uvh
https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
yum clean all
安装zabbix
yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent -y
安装mariadb数据库
yum install mariadb mariadb-server -y
配置数据库
systemctl start mariadb
systemctl enable mariadb
mysql -u root
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'password';
mysql> quit;
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -u zabbix -p zabbix
配置zabbix-server
vim /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=password
运行zabbix-server
systemctl enable zabbix-server
systemctl start zabbix-server
配置zabbix-agent
vim /etc/zabbix/zabbix_agentd.conf
Server=10.1.26.200
ServerActive=10.1.26.200
Hostname=10.1.32.51
ListenPort=10050
运行zabbix-agent
systemctl enable zabbix-agent
systemctl start zabbix-agent
安装php7.4
参考链接:https://blog.csdn.net/sun2378/article/details/113449765
#创建epel源
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
#再创建两个repo
cat >/etc/yum.repos.d/remi-php74.repo<< EOF
[remi-php74]
name=php74 for Enterprise Linux 7 - $basearch
baseurl=https://mirrors.tuna.tsinghua.edu.cn/remi/enterprise/7/php74/x86_64/
failovermethod=priority
enabled=1
gpgcheck=0
EOF
cat >/etc/yum.repos.d/remi-safe.repo<< EOF
[remi-safe]
name=remi-safe for Enterprise Linux 7 - $basearch
baseurl=https://mirrors.tuna.tsinghua.edu.cn/remi/enterprise/7/safe/x86_64/
failovermethod=priority
enabled=1
gpgcheck=0
EOF
yum makecache
yum install php php-fpm php-mysqlnd php-devel php-gd php-mbstring php-pecl-mcrypt php-xml php-opcache php-pecl-memcached -y
php配置文件在/etc/php.ini,在安装web端还需要改几个参数。
安装nginx
yum install nginx
systemctl enable nginx
systemctl start nginx
修改nginx配置文件如下
vim /etc/nginx/nginx.conf
server {
listen 80;
listen [::]:80;
server_name _;
#配置目录
root /www/wwwroot/zabbix;
index index.php index.html index.htm default.php default.htm default.html;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
#配置nginx 支持php
location ~ \.php$ {
#配置目录
root /www/wwwroot/zabbix;
#默认9000端口
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
error_page 404 /404.html;
location = /404.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
部署zabbix server web端
https://cdn.zabbix.com/zabbix/sources/stable/5.0/zabbix-5.0.15.tar.gz
解压后有个ui文件夹,里面就是web源码,上传到web目录
访问地址/setup.php,配置web端。配置后登录,默认密码Admin 密码zabbix
访问web端,查看Zabbix server is running是不是YES,
如果是NO,查看log解决
cat
/var/log/zabbix/zabbix_server.log
cat /var/log/zabbix/zabbix_agentd.log
发表评论