Zabbix5.0LTS安装笔记

《Zabbix5.0LTS安装笔记》

环境要求

请先自行安装:tengine(nginx)、php、mysql

博主的是 tengine2.3.2 php7.3 mysql8.0.17

到官网下载最新版本:(源官网安装教程地址)

https://www.zabbix.com/cn/download?zabbix=5.0&os_distribution=centos&os_version=7&db=mysql&ws=nginx

安装 Zabbix rpm包

# rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
# yum clean all 

安装Zabbix服务\前端\代理

# yum -y install zabbix-server-mysql zabbix-agent

创建数据库用户并添加数据库

# mysql -uroot -p
 password
 mysql> create database zabbix character set utf8 collate utf8_bin;   //创建数据库
 mysql> set global validate_password.policy=LOW;  //允许不严格的密码
 mysql> create user 'zabbix'@'localhost' IDENTIFIED WITH mysql_native_password BY 'you_password'; //创建用户并加入密码
 mysql> grant all privileges on zabbix.* to zabbix@localhost;  //加权限
 mysql> FLUSH PRIVILEGES;  //刷新权限表
 mysql> quit;

导入数据到数据库

# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -f zabbix -p

配置Zabbix server数据库

# vi /etc/zabbix/zabbix_server.conf
 DBPassword=password

配置PHP及nginx

//复制这个文件到你的tengine服务器下,请根据自己的实际情况修改
/etc/opt/rh/rh-nginx116/nginx/conf.d/zabbix.conf(一定要复制)

//主要包含以下两点:
//其中:fastcgi_pass根据你配置的php来填写,下文是127.0.0.0:9000
------------------------------------------------------
listen 80;
listen 443 ssl;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_certificate /etc/letsencrypt/live/xxx.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/xxx.com/privkey.pem;
server_name status.xxx.com; //可以被访问即可,其他配置照搬
location ~ [^/]\.php(/|$) {
      fastcgi_pass     127.0.0.1:9000; //自己php的配置
      fastcgi_split_path_info ^(.+\.php)(/.+)$;
      fastcgi_index   index.php;

      fastcgi_param   DOCUMENT_ROOT   /usr/share/zabbix;
      fastcgi_param   SCRIPT_FILENAME /usr/share/zabbix$fastcgi_script_name;
      fastcgi_param   PATH_TRANSLATED /usr/share/zabbix$fastcgi_script_name;

      include fastcgi_params;
      fastcgi_param   QUERY_STRING    $query_string;
      fastcgi_param   REQUEST_METHOD  $request_method;
      fastcgi_param   CONTENT_TYPE    $content_type;
      fastcgi_param   CONTENT_LENGTH  $content_length;

      fastcgi_intercept_errors        on;
      fastcgi_ignore_client_abort     off;
      fastcgi_connect_timeout         60;
      fastcgi_send_timeout            180;
      fastcgi_read_timeout            180;
      fastcgi_buffer_size             128k;
      fastcgi_buffers                 4 256k;
      fastcgi_busy_buffers_size       256k;
      fastcgi_temp_file_write_size    256k;
}

启动Zabbix server和agent进程

# systemctl restart zabbix-server zabbix-agent nginx php-fpm
# systemctl enable zabbix-server zabbix-agent nginx php-fpm

访问浏览器

http://server_ip_or_name
//如果出现session问题请尝试换个浏览器,....,不行再试下session目录权限

默认账号密码:Admin=zabbix

中文按下图选择

《Zabbix5.0LTS安装笔记》
《Zabbix5.0LTS安装笔记》
点赞

发表评论

电子邮件地址不会被公开。 必填项已用*标注