首页 > 其他分享 >Zabbix 6.0LTS部署

Zabbix 6.0LTS部署

时间:2023-09-13 21:00:36浏览次数:34  
标签:LTS mysql zabbix nginx Zabbix usr 6.0 php root

yum安装zabbix 6.0 数据库mysql 8.0

系统版本CentOS Linux release 7.9.2009 (Core)

所有密码都是Start123!


##关闭selinux

[root@Zabbix-Server ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config

##禁用防火墙

[root@Zabbix-Server ~]# systemctl disable --now firewalld

##重启

[root@Zabbix-Server ~]# reboot

##查看selinux状态

[root@Zabbix-Server ~]# sestatus

SELinux status:                 disabled

##查看防火墙状态

[root@Zabbix-Server ~]# systemctl status firewalld.service


[root@Zabbix-Server ~]# groupadd --system zabbix

groupadd:“zabbix”组已存在

[root@Zabbix-Server ~]# useradd --system -g zabbix -d /usr/lib/zabbix -s /sbin/nologin -c "Zabbix Monitoring System" zabbix

useradd:用户“zabbix”已存在

添加文件夹

[root@Zabbix-Server ~]# mkdir -m u=rwx,g=rwx,o= -p /usr/lib/zabbix

给zabbix用户授权文件夹权限

[root@Zabbix-Server ~]# chown zabbix:zabbix /usr/lib/zabbix


##安装依赖

[root@Zabbix-Server ~]# yum -y install gcc gcc-c++ unixODBC-devel httpd mysql-devel libcurl libcurl-devel libevent libevent-devel fping curl-devel libxml2  libxml2-devel s参nmpd net-snmp-devel net-snmp


到官网下载zabbix包,上传到tmp目录下

查看文件

ls

解压zabbix

tar -zxvf zabbix-6.0.21.tar.gz

进入zabbix目录

cd zabbix-6.0.21/

编译

./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2

##出现以下表示预编译成功

***********************************************************

*            Now run 'make install'                       *

*                                                         *

*            Thank you for using Zabbix!                  *

*              <http://www.zabbix.com>                    *

***********************************************************

##安装,无任何报错后继续

安装

make install




##查询系统是否已经安装了mysql数据库

[root@Zabbix-Server ~]# rpm -qa | grep mysql

##查询系统是否已经安装了mariadb

[root@Zabbix-Server ~]# rpm -pa | grep mariadb

##查找mysql下载源

https://repo.mysql.com/

找到对应的mysql地址下载

wget https://repo.mysql.com/mysql80-community-release-el7-7.noarch.rpm

安装rpm

rpm -ivh mysql80-community-release-el7-7.noarch.rpm

安装mysql

yum install -y mysql-community-server

设置开机自启动

systemctl start mysqld.service && systemctl enable mysqld.service

查看数据库版本

mysql -V

mysqld -V

查找mysql安装时默认密码

grep 'temporary password' /var/log/mysqld.log

更改默认密码

mysql -uroot -p

ALTER USER 'root'@'localhost' IDENTIFIED BY 'Start123!';

exit;

##初始化数据库, 按提示初始化

[root@Zabbix-Server ~]# mysql_secure_installation

删除匿名用户,禁止远程登录,删除测试数据库

##使用新密码登录数据库测试

登录数据库,建zabbix数据库

mysql -uroot -p


create database zabbix character set utf8 collate utf8_bin;


create user zabbix@localhost identified by 'Start123!';


grant all privileges on zabbix.* to zabbix@localhost;


show databases;


use zabbix;


ALTER USER 'zabbix'@'localhost' IDENTIFIED WITH mysql_native_password BY 'Start123!';


source /tmp/zabbix-6.0.21/database/mysql/schema.sql;

source /tmp/zabbix-6.0.21/database/mysql/images.sql;

source /tmp/zabbix-6.0.21/database/mysql/data.sql;

exit;


安装nginx

下载nginx

wget http://nginx.org/download/nginx-1.22.1.tar.gz

解压nginx

tar -xzvf nginx-1.22.1.tar.gz

进入nginx-1.22.1目录

cd nginx-1.22.1/

编译nginx

./configure --prefix=/usr/local/nginx


make && make install

进入nginx目录

cd /usr/local/nginx/sbin/

启动nginx

./nginx

访问服务器地址查看有welcome to nginx即完成

设置开机启动,进入system目录

cd /lib/systemd/system/

添加nginx.service文件

vim nginx.service

添加以下内容

[Unit]


Description=nginx


After=network.target


[Service]


Type=forking


ExecStart=/usr/local/nginx/sbin/nginx


ExecReload=/usr/local/nginx/sbin/nginx reload


ExecStop=/usr/local/nginx/sbin/nginx quit


PrivateTmp=true


[Install]


WantedBy=multi-user.target

保存完成

设置开机启动

systemctl enable nginx.service




安装php

yum -y install epel-release yum-utils


rpm -ivh https://mirrors.tuna.tsinghua.edu.cn/remi/enterprise/remi-release-7.9.rpm

ls

yum-config-manager --enable remi-php80



yum -y install php php-fpm php-json php-gd php-bcmath php-mbstring php-xmlwriter php-xmlreader php-mysqli  php-ldap

yum -y install  php-cli php-mysqlnd php-zip php-devel php-gd php-mbstring php-curl php-xml php-pear php-bcmath php-json php-redis



vi /etc/php.ini

修改post_max_size=16M

max_execution_time=300

max_input_time=300



##开启相关服务

systemctl start php-fpm && systemctl enable  php-fpm

##重启 php

systemctl restart php-fpm



将nginx与php结合

vim /usr/local/nginx/conf/nginx.conf

修改以下内容

location中添加 index.php


location / {

root   html;

index  index.php index.html index.htm;

}


去掉location的注释,

将/script更改这$document_root

location ~ \.php$ {

       root           html;

       fastcgi_pass   127.0.0.1:9000;

       fastcgi_index  index.php;

       fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

       include        fastcgi_params;

   }

重新加载nginx

/usr/local/nginx/sbin/nginx -t

/usr/local/nginx/sbin/nginx -s reload

创建测试文件

echo "<?php phpinfo(); ?>" >> /usr/local/nginx/html/index.php

浏览器访问http://服务器IP/index.php

出现php页面,说明正常


修改zabbix_server.conf配置文件中DBPassword的值为zabbix数据库的密码

find / -name zabbix_server.conf

修改zabbix配置中数据库密码

vi /usr/local/etc/zabbix_server.conf

DBPassword=Start123!

跳到sbin目录,启动zabbix_server和zabbix_agentd



cd /usr/local/sbin/

./zabbix_server

./zabbix_agentd

创建文件夹

mkdir  -p /usr/local/nginx/html/zabbix

复制zabbix到nginx下新建的zabbix目录

cp -r /tmp/zabbix-6.0.21/ui/* /usr/local/nginx/html/zabbix/

授权

chmod 777 /usr/local/nginx/html/zabbix/conf

访问

http://服务器地址/zabbix/setup.php

出现zabbix页面,进行初始化

初始化完成后,使用默认用户名Admin 默认密码zabbix登录


解决中文乱码

先查找文件

find / -name defines.inc.php

根据relpath中fonts查找文件夹

find / -name fonts

在windows系统中拷贝黑体常规字体,上传到查找到的fonts文件夹中

/usr/local/nginx/html/zabbix/assets/fonts

进入文件夹

cd /usr/local/nginx/html/zabbix/assets/fonts

查看文件

ls

DejaVuSans.ttf  SIMHEI.TTF

备份原来字体文件

cp DejaVuSans.ttf DejaVuSans.ttf.bak

复制当前字体文件替换之前字体文件

cp SIMHEI.TTF DejaVuSans.ttf

标签:LTS,mysql,zabbix,nginx,Zabbix,usr,6.0,php,root
From: https://blog.51cto.com/u_13879648/7464231

相关文章

  • Bug库____org.springframework.jdbc.IncorrectResultSetColumnCountException: Incorr
    Bug:使用到了spring的jdbctemplate模板使用到以下template.queryForObject(sql,requiredType)template.queryForList(sql,elementType,args)报以下错误org.springframework.jdbc.IncorrectResultSetColumnCountException:Incorrectcolumncount:expected1,actual3检查完......
  • BUG(Spring Framework JdbcTemplate) org.springframework.jdbc.IncorrectResultSetCo
    一.SpringFramework queryForObject问题1.spring4.0之前使用使用jdbctemplate的queryForObject(Stringsql,Object[]args,RowMapper<T>rowMapper)直接放入class类型会报错org.springframework.jdbc.IncorrectResultSetColumnCountException:Incorrectcolumncount:expec......
  • ubuntu版本为16.04,英文改成中文解决方法和解决中文输入法无效的问题
     终端输入:locale-gen然后等待下载,完成后重启ubuntu之后ubuntu就会变成中文,重启后,保留旧的名称。关于中文输入法无效,看这篇文章:  https://www.yisu.com/ask/10114874.html好了,就是下图这种  ......
  • ubuntu16.04安装cuda8.0+pytorch1.0.0
    1.安装cuda1.1查看ubuntu的英伟达显卡驱动nvidia-smi得到驱动版本是384.130,比较老,所以需要下载旧版本的cuda1.2查看显卡是否支持CUDA计算然后去到这里https://developer.nvidia.com/cuda-gpus查看你的显卡是否在表中,在的话你显卡就是支持CUDA计算的(CUDA-capable)。结果......
  • ZABBIX6.0监控MySQL
    官方文档:https://www.zabbix.com/cn/integrations/mysql部署过程:1.在MySQL数据库中创建监控账号并授权CREATEUSER'zabbix'@'%'IDENTIFIEDBY'Likun@123';GRANTUSAGE,REPLICATIONCLIENT,PROCESS,SHOWDATABASES,SHOWVIEWON*.*TO'zabbix'@�......
  • 【6.0】RabbitMQ使用之发布订阅
    【一】发布订阅【1】发布者importpika#【1】创建连接并设置认证信息credentials=pika.PlainCredentials("admin","admin")connection=pika.BlockingConnection(pika.ConnectionParameters('101.133.225.166',credentials=credentials))#【2】创建通道channel......
  • Ubuntu 22.04 LTS修改登录后的欢迎信息
    上一篇介绍了开机信息的修改,这一篇记录一下Ubuntu22.04LTS用户登录后的欢迎信息使用管理账号登录 sudosuroot 进入到/etc/update-motd.d目录下面,新建文件99-my-welcome-info新建文件代码touch99-my-welcome-info1修改当前文件权限sudochmod777......
  • Ubentu 16.04.2 LTS安装mysql,jdk1.8
    一、网络设置1、网络设置sudovim/etc/network/interfaces文件中写入以下内容,写完后wq保存退出。#设置网卡名称autoeth0#设置静态IP,如果是使用自动IP用dhcp,后面的不用设置ifaceeth0inetstatic#设置IP地址addressxxx.xxx.xxx.xxx#设置子网掩码netmaskxxx.xxx.xxx.......
  • zabbix+oracle环境部署
    oracle11安装完成后,实例名:zbx01oracle创建zbx01用户:colfile_namefora60;setlinesize160;selectfile_name,tablespace_name,bytesfromdba_data_files; createtablespaceZBX01datafile'/u01/oracle/oradata/zbx01/zbx01.dbf'size5gautoextendon; CREATEU......
  • Metinfo6.0.0任意文件读取漏洞复现
    1.1、漏洞描述漏洞名称:MetInfo任意文件读取漏洞简介:MetInfo是一套使用PHP和MySQL开发的内容管理系统,其中的/app/system/include/module/old_thumb.class.php文件存在任意文件读取漏洞,攻击者可利用该漏洞读取网站的敏感文件。下载地址:历史版本安装文件下载Ver_6.0.01.2、漏洞......