美文网首页
zabbix6.6编译安装

zabbix6.6编译安装

作者: JepWei | 来源:发表于2022-07-03 00:36 被阅读0次

1.源码包下载及创建用户

cd /usr/src/
wget https://cdn.zabbix.com/zabbix/sources/stable/6.0/zabbix-6.0.6.tar.gz
tar xvf zabbix-6.0.2.tar.gz
ln -s zabbix-6.0.2 zabbix
groupadd --system zabbix
useradd --system -g zabbix -d /usr/lib/zabbix -s /sbin/nologin -c "Zabbix Monitoring System" zabbix

2.mysql8数据库

cd /usr/local/
wget https://downloads.mysql.com/archives/get/p/23/file/mysql-8.0.27-linux-glibc2.12-x86_64.tar.xz
tar xvf mysql-8.0.27-linux-glibc2.12-x86_64.tar.xz
ln -s mysql-8.0.27-linux-glibc2.12-x86_64 mysql
useradd mysql
vim /etc/profile
export PATH=$PATH:/usr/local/mysql/bin

source /etc/profile

vim /etc/my.cnf
[client]
socket=/data/mysql/3306/data/mysql.sock

[mysqld]
#server configuration
user=mysql
datadir=/data/mysql/3306/data
basedir=/usr/local/mysql
port=3306
socket=/data/mysql/3306/data/mysql.sock
log_timestamps=system
log_error=/data/mysql/3306/data/mysqld.err
skip_name_resolve

#Replication Framework
server_id=1
master_info_repository=TABLE
relay_log_info_repository=TABLE
log_slave_updates=ON
log_bin=mysql-bin
binlog_format=ROW

#启动数据库
mkdir -p /data/mysql/3306/data/
/usr/local/mysql/bin/mysqld --defaults-file=/etc/my.cnf --initialize-insecure
/usr/local/mysql/bin/mysqld_safe --defaults-file=/etc/my.cnf &


#进数据库mysql -uroot -p 直接回车
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> create user 'zabbix_admin'@'%' identified with mysql_native_password by 'zabbix_pass';
mysql> grant all privileges on zabbix.* to 'zabbix_admin'@'%';

#导入zabbix源码包里的数据
cd /usr/src/zabbix/database/mysql/
mysql -h127.0.0.1 -uzabbix_admin -pzabbix_pass zabbix < schema.sql
mysql -h127.0.0.1 -uzabbix_admin -pzabbix_pass zabbix < images.sql 
mysql -h127.0.0.1 -uzabbix_admin -pzabbix_pass zabbix < data.sql

#准备编译zabbix
yum install gcc mysql-devel libevent-devel libcurl-devel libxml2-devel net-snmp-devel
ln -s /usr/local/mysql-8.0.27-linux-glibc2.12-x86_64/lib/private/libssl.so.1.1 /usr/lib64
ln -s /usr/local/mysql-8.0.27-linux-glibc2.12-x86_64/lib/private/libcrypto.so.1.1 /usr/lib64
cd /usr/src/zabbix
./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql=/usr/local/mysql/bin/mysql_config --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2
make install

#编译完成后,看看 /usr/local/zabbix/ 目录的内容是否齐全

3.配置zabbix的配置文件

vi /usr/local/zabbix/etc/zabbix_server.conf
LogFile=/tmp/zabbix_server.log
DBHost=127.0.0.1
DBName=zabbix
DBUser=zabbix_admin
DBPassword=zabbix_pass
DBPort=3306
Timeout=4
LogSlowQueries=3000
StatsAllowedIP=127.0.0.1
CacheSize=2048M

vi /usr/local/zabbix/etc/zabbix_agentd.conf
LogFile=/tmp/zabbix_agentd.log
Server=127.0.0.1
ServerActive=127.0.0.1
Hostname=Zabbix server

#配置服务端启动文件
vi /usr/src/zabbix/misc/init.d/fedora/core5/zabbix_server
...
ZABBIX_BIN="/usr/local/zabbix/sbin/zabbix_server"
CONFIG_FILE="/usr/local/zabbix/etc/zabbix_server.conf"
...
start() {
        echo -n $"Starting $prog: "
        daemon $ZABBIX_BIN -c $CONFIG_FILE

cp /usr/src/zabbix/misc/init.d/fedora/core5/zabbix_server /etc/init.d/

#配置客户端启动文件
vi /usr/src/zabbix/misc/init.d/fedora/core5/zabbix_agentd
...
ZABBIX_BIN="/usr/local/zabbix/sbin/zabbix_agentd"
CONFIG_FILE="/usr/local/zabbix/etc/zabbix_agentd.conf"
...
start() {
        echo -n $"Starting $prog: "
        daemon $ZABBIX_BIN -c $CONFIG_FILE
...

cp /usr/src/zabbix/misc/init.d/fedora/core5/zabbix_agentd /etc/init.d/

#启动服务
ln -s /usr/local/mysql/lib/libmysqlclient.so.21 /usr/lib64
service zabbix_server start
service zabbix_agentd start
chkconfig zabbix_server on
chkconfig zabbix_agentd on

4.配置web组件(php)

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum -y install yum-utils
yum-config-manager --enable remi-php72
yum install httpd php72w-cli php72w-common php72w-gd php72w-ldap php72w-mbstring php72w-mysqlnd php72w-xml php72w-bcmath mod_php72w -y
#检查php的版本是不是7.2(务必确认)
php -v

mkdir -p /var/www/html/zabbix
cp -r /usr/src/zabbix/ui/* /var/www/html/zabbix
chown -R apache.apache /var/www/html/

vi /etc/php.ini
max_execution_time = 300
max_input_time = 300
memory_limit = 128M
post_max_size = 16M
upload_max_filesize = 2M
date.timezone = Asia/Shanghai

service httpd start
chkconfig httpd on

5.配置zabbix向导(最后)

浏览器中输入 http://192.168.0.127/zaabix

image.png
image.png

6.客户端配置连接至zabbix

rpm -ivh zabbix-agent2-6.0.6-1.el7.x86_64.rpm
(下载地址:http://repo.zabbix.com/zabbix/6.0/rhel/7/x86_64/zabbix-agent2-6.0.6-1.el7.x86_64.rpm)

vi /etc/zabbix/zabbix-agent2.conf
LogFile=/tmp/zabbix_agentd.log
Server=192.168.0.127   #服务端地址
ServerActive=127.0.0.1
Hostname=192.168.0.128.   #客户端地址


systemctl restart zabbix-agent2

#查看日志排错
tail -f /var/log/zabbix/zabbix.agent2.log

相关文章

  • zabbix6.6编译安装

    1.源码包下载及创建用户 2.mysql8数据库 3.配置zabbix的配置文件 4.配置web组件(php) 5...

  • zabbix6.6容器安装

    zabbix 6.0 docker部署

  • 搭建并配置LAMP/LNMP环境

    如何编译安装软件编译安装是Linux安装软件的重要方式编译前的准备工作:./configure编译:make安装:...

  • Linux下编译Xmrig

    安装依赖 Ubuntu CentOS 安装 创建编译文件夹 编译安装 基本编译方式 静态编译方式 编译完成后使用l...

  • php 手动编译添加扩展

    在完成 php的编译安装后, 发现没有编译某此模块。手动添加安装。php源码编译安装 编译安装 在php源码包中 ...

  • 编译安装LNMP

    编译安装nginx 编译安装PHP 配置Nginx+PHP 安装MySQL

  • 编译安装LNMP2

    编译安装nginx 编译安装PHP 配置Nginx+PHP 安装MySQL

  • Centos7 安装Nginx

    一、编译安装 1、安装编译安装所需要的依赖 2、下载Nginx 3、解压 4、编译安装(默认设置) 5、查看安装目...

  • Hbuilder scss/sass编译 插件

    1. 安装插件 工具 -> 插件安装 -> scss/sass编译 -> 安装安装 scss/sass编译 插件 ...

  • nginx+passenger配置rails的生产环境

    先编译方式安装好nginx ==> 安装教程 安装passenger 编译安装,只需要在原来的编译配置参数后补上就...

网友评论

      本文标题:zabbix6.6编译安装

      本文链接:https://www.haomeiwen.com/subject/bdklbrtx.html