网站建设黄页,肥城市网站建设,宝山网站建设 网站外包,wordpress文章加密插件zabbix 7.0编译部署教程 2024-03-08 16:50乐维社区 zabbix7.0 alpha版本、beta版本已经陆续发布#xff0c;Zabbix7.0 LTS版本发布时间也越来越近。据了解#xff0c;新的版本在性能提升、架构优化等新功能方面有非常亮眼的表现#xff0c;不少小伙伴对此也已经跃跃欲试。心…zabbix 7.0编译部署教程 2024-03-08 16:50·乐维社区 zabbix7.0 alpha版本、beta版本已经陆续发布Zabbix7.0 LTS版本发布时间也越来越近。据了解新的版本在性能提升、架构优化等新功能方面有非常亮眼的表现不少小伙伴对此也已经跃跃欲试。心动不如行动不妨先体验了一把beta版本。
本教程仅适用于编译部署Zabbix7.0 beta1版本部署环境为kylinV10。文章内容来源于乐维社区。
事前准备软件包下载 l kylinV10 sp2 x86_64: https://pan.baidu.com/s/1-pg76mcXLn8rWP22Adr1iA?pwdlwjk 提取码: lwjk
l nginx: https://nginx.org/download/nginx-1.24.0.tar.gz
l php: https://www.php.net/distributions/php-8.3.3.tar.gz
l pg:https://ftp.postgresql.org/pub/source/v16.2/postgresql-16.2.tar.gz
l timescaledb:https://codeload.github.com/timescale/timescaledb/tar.gz/refs/tags/2.13.1
l zabbix:https://cdn.zabbix.com/zabbix/sources/development/7.0/zabbix-7.0.0beta1.tar.gz
lnpp安装 linuxnginxpostgresqlphp
(1) 本操作示例中linux环境使用kylinV10 SP2 (2) 环境已配置公网yum源 1.1. nginx安装 选择nginx版本 1.24.0
(1) yum 安装工具及环境依赖
#编译工具安装 yum -y install gcc-c #nginx 依赖安装 yum -y install pcre-devel openssl-devel
(2) itops用户创建
#程序用户itops创建 groupadd itops useradd -g itops itops echo Kylin_pssw0rd | passwd --stdin itops
(3) nginx编译操作
tar xf nginx-1.24.0.tar.gz cd nginx-1.24.0/ ./configure --useritops --groupitops --prefix/opt/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-pcre make -j8 make install
(4) nginx配置文件编写
mv /opt/nginx/conf/nginx.conf /opt/nginx/conf/nginx.bak vi /opt/nginx/conf/nginx.conf #i#输入 user itops itops; worker_processes 1;
error_log logs/error.log crit; error_log logs/error.log notice; error_log logs/error.log info; pid logs/nginx.pid;
events { worker_connections 1024; }
http { include mime.types; default_type application/octet-stream; #access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;server {listen 80;server_name localhost;#charset koi8-r;#access_log logs/host.access.log main;location / {root html;index index.html index.htm index.php;}error_page 500 502 503 504 /50x.html;location /50x.html {root html;}location ~ \.php$ {fastcgi_pass 127.0.0.1:9000;fastcgi_index index.php;fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;include fastcgi_params;}
}}
测试nginx配置格式
chown itops: -R /opt/zabbix /opt/nginx/sbin/nginx -t
(5) nginx服务文件编写
vi /usr/lib/systemd/system/nginx.service #i# 输入 [Unit] Descriptionnginx Afternetwork.target [Service] Typeforking ExecStart/opt/nginx/sbin/nginx -c /opt/nginx/conf/nginx.conf ExecReload/opt/nginx/sbin/nginx -s reload ExecStop/opt/nginx/sbin/nginx -s quit PrivateTmptrue [Install] WantedBymulti-user.target
(6) nginx服务启动及自启
systemctl enable nginx --now (7) 页面访问测试 1.2. 数据库安装 选择postgresql 版本16.2
选择timescaledb 版本2.13.1
(1) yum安装工具及环境依赖
yum install -y unzip gcc gcc-c perl readline readline-devel openssl openssl-devel zlib zlib-devel ncurses-devel perl-ExtUtils-Embed python python-devel libxslt* python3-devel
(2) cmake 工具安装
yum install cmake -y
cmake版本需大于3.4版本如yum方式安装cmake版本低则需要用手动编译方式进行替换
cmake --version
(3) PG编译安装
编译PG
tar xf postgresql-16.2.tar.gz cd postgresql-16.2/ ./configure --prefix/opt/postgresql --with-pgport5432 --with-segsize16 --with-blocksize32 --with-wal-blocksize64 --with-libedit-preferred --with-perl --with-openssl --with-libxml --with-python --with-libxslt --enable-thread-safety --enable-nlsen_US.UTF-8 --without-icu make -j8 make install
初始化
mkdir /data chown itops: /data su - itops /opt/postgresql/bin/initdb -D /data/postgresql -E utf8
启动
/opt/postgresql/bin/pg_ctl -D /data/postgresql/ start
设定全局变量
vim /etc/profile #i # 尾行追加如下部分 PATH/opt/postgresql/bin:/usr/bin:/usr/sbin:/bin:/sbin/bin export PATH PG_CONFIG/opt/postgresql/bin/pg_config export PG_CONFIG PGDATA/data/postgresql export PGDATA LD_LIBRARY_PATH/opt/postgresql/lib:$LD_LIBRARY_PATH export LD_LIBRARY_PATH
执行如下命令使变量生效
source /etc/profile
(4) TS时序库编译可选
tar xf timescaledb-2.13.1.tar.gz cd timescaledb-2.13.1/ echo y | ./bootstrap -DREGRESS_CHECKSOFF cd ./build make make install
PG配置载入ts模块
echo “shared_preload_libraries ‘timescaledb’” /data/postgresql/postgresql.conf
重启pg令模块生效
su - itops -c ‘pg_ctl restart’
(5) pg服务文件编写
vi /usr/lib/systemd/system/postgresql.service #i# 输入 [Unit] DescriptionPostgreSQL database server Afternetwork.target
[Service] Typeforking Useritops Groupitops EnvironmentPGPORT5432 EnvironmentPGDATA/data/postgresql OOMScoreAdjust-1000 ExecStart/opt/postgresql/bin/pg_ctl start -D ${PGDATA} -s -o “-p ${PGPORT}” -w -t 300 ExecStop/opt/postgresql/bin/pg_ctl stop -D ${PGDATA} -s -m fast ExecReload/opt/postgresql/bin/pg_ctl reload -D ${PGDATA} -s TimeoutSec300 [Install] WantedBymulti-user.target
(6) pg服务启动及自启
su - itops -c ‘pg_ctl stop’ systemctl enable postgresql --now
1.3. php安装 选择php版本 8.3.3
(1) yum 安装工具及环境依赖
oniguruma、oniguruma-devel包(kylinV10) yum -y install libxml2-devel bzip2-devel libcurl-devel libpng-devel libjpeg-devel freetype-devel gmp-devel openldap-devel readline-devel libxslt-devel net-snmp-devel cp -frp /usr/lib64/libldap* /usr/lib/ yum install oniguruma-*
#编译安装php tar xf php-8.3.3.tar.gz cd php-8.3.3/ ./configure --prefix/opt/php --with-config-file-path/opt/php/etc --with-pgsql/opt/postgresql --with-pdo-pgsql/opt/postgresql --enable-gd --enable-bcmath --with-jpeg --with-freetype --enable-ctype --enable-xml --enable-session --enable-sockets --enable-mbstring --with-gettext --with-ldap --with-openssl --without-pdo-sqlite --without-sqlite3 --enable-fpm sed -i “s-lcrypto-lcrypto -llberg” Makefile make -j8 make install #配置php相关参数 cp php.ini-production /opt/php/etc/php.ini ln -s /opt/php/etc/php.ini /etc/php.ini cp /opt/php/etc/php-fpm.conf.default /opt/php/etc/php-fpm.conf cp /opt/php/etc/php-fpm.d/www.conf.default /opt/php/etc/php-fpm.d/www.conf sed -i “suser nobodyuser itopsg” /opt/php/etc/php-fpm.d/www.conf sed -i “sgroup nobodygroup itopsg” /opt/php/etc/php-fpm.d/www.conf sed -i “spm.max_children 5pm.max_children 30g” /opt/php/etc/php-fpm.d/www.conf sed -i “s;pid run/php-fpm.pidpid run/php-fpm.pidg” /opt/php/etc/php-fpm.d/www.conf sed -i “spost_max_size 8Mpost_max_size 16Mg” /opt/php/etc/php.ini sed -i “smax_execution_time 30max_execution_time 300g” /opt/php/etc/php.ini sed -i “smax_input_time 60max_input_time 300g” /opt/php/etc/php.ini
#生成php-fpm启动文件 cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm chmod x /etc/init.d/php-fpm chown -R itops: /opt/php systemctl enable php-fpm --now
zabbix安装及启动 2.1. zabbix 编译安装 选择zabbix版本 7.0.0beta1
(1) yum 安装编译工具及依赖
yum -y install libssh2 libssh2-devel OpenIPMI-devel libevent-devel unixODBC unixODBC-devel java-1.8.0-openjdk-devel openssl-devel
(2) zabbix编译及配置参数定义
tar xf zabbix-7.0.0beta1.tar.gz cd zabbix-7.0.0beta1 ./configure --prefix/opt/zabbix --enable-server --enable-agent --with-postgresql/opt/postgresql/bin/pg_config --with-net-snmp --with-libcurl --with-libxml2 --with-unixodbc --with-openipmi --enable-ipv6 --enable-java --with-openssl --with-ssh2 --with-iconv --with-iconv-include --with-iconv-lib --with-libpcre --with-libevent --with-zlib --with-zlib-include --with-zlib-lib --with-libpthread --with-ldap make -j8 make install chown itops: -R /opt/zabbix vi /opt/zabbix/etc/zabbix_server.conf #文件最后追加如下行 LogFile/tmp/zabbix_server.log DBHostlocalhost DBNamezabbix DBUserzabbix DBPasswordZABBIX DBPort5432 Timeout4 LogSlowQueries3000 Useritops StatsAllowedIP127.0.0.1
(3) zabbix库创建
#创建zabbix用户 su - itops -c ‘createuser --pwprompt zabbix’ #输入用户密码
创建zabbix库 su - itops -c ‘createdb -O zabbix -E Unicode -T template0 zabbix’ (4) 数据库表结构导入
#进入编译包数据库路径下 cd zabbix-7.0.0beta1/database/postgresql/ #导入表结构 cat schema.sql | /opt/postgresql/bin/psql -Uzabbix zabbix cat images.sql | /opt/postgresql/bin/psql -Uzabbix zabbix cat data.sql | /opt/postgresql/bin/psql -Uzabbix zabbix /opt/postgresql/bin/psql -Uzabbix zabbix -c ‘CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE’ #关闭压缩如果需要正常压缩则跳过下方sed命令 sed -i ‘s#compression_status1#compression_status0#g’ timescaledb/schema.sql cat timescaledb/schema.sql | /opt/postgresql/bin/psql -Uzabbix zabbix #抛出 TimescaleDB is configured successfully 即视为超表创建成功其余提示信息可忽略 2.2. zabbix 服务及agent程序启动 (1) 启动zabbix_server
/opt/zabbix/sbin/zabbix_server ss -lnt 2) zabbix agent启动
echo ‘Useritops’ /opt/zabbix/etc/zabbix_agentd.conf /opt/zabbix/sbin/zabbix_agentd
2.3. zabbix_web 配置及初始化 (1) web部署
#进入编译包路径下 cd zabbix-7.0.0beta1/ #拷贝ui代码至nginx cp -r ui/ /opt/nginx/html/zabbix chown itops: -R /opt/nginx/html/zabbix
(2) web页面初始化配置 以上就是Zabbix7.0 beta1编译部署的全部内容感兴趣的小伙伴不妨抢先上车体验。
此外乐维监控V7.0版本也即将与大家见面敬请期待。
大家好我是乐乐专注运维技术研究与分享更多Zabbix等技术知识与问题欢迎到乐维社区交流~