栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

zabbix5.4.4部署

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

zabbix5.4.4部署

zabbix5.4.4部署

环境说明:

系统平台IP需要安装的服务
contos7192.168.47.128httpd
mysql5.7.34
php7.4.24
zabbix5.4.4

安装顺序:

lamp>zabbix
安装lamp

[root@apache apache]# httpd -v
Server version: Apache/2.4.49 (Unix)
Server built:   Sep 27 2021 09:42:08

[root@apache apache]# mysql -V
mysql  Ver 14.14 Distrib 5.7.34, for linux-glibc2.12 (x86_64) using  EditLine wrapper

[root@apache apache]# ss -anlit
LISTEN     0          128                  127.0.0.1:9000                0.0.0.0:*        
         cubic cwnd:10     
LISTEN     0          128                          *:80                        *:*           
         cubic cwnd:10     
LISTEN     0          80                           *:3306                      *:*        
         cubic cwnd:10     

安装zabbix
//下载依赖包
[root@apache apache]# yum -y install net-snmp-devel libevent-devel
[root@apache apache]# cd /usr/src/
//下载安装包
[root@apache src]# wget https://cdn.zabbix.com/zabbix/sources/stable/5.4/zabbix-5.4.4.tar.gz
//解压
[root@apache src]# tar -xf zabbix-5.4.4.tar.gz 
[root@apache src]# useradd -r -M -s /sbin/nologin zabbix
//创建mysql用户
[root@apache src]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 5
Server version: 5.7.34 MySQL Community Server (GPL)

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

mysql> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)

mysql> grant all privileges on zabbix.* to 'zabbix'@'localhost' identified by 'zabbix123!';
Query OK, 0 rows affected, 2 warnings (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye
导入库数据
[root@apache src]# cd /usr/src/zabbix-5.4.4/database/mysql/
[root@apache mysql]# ls
data.sql  double.sql  images.sql  Makefile.am  Makefile.in  schema.sql
[root@apache mysql]# mysql -uzabbix -p'zabbix123!' zabbix < schema.sql
mysql: [Warning] Using a password on the command line interface can be insecure.
[root@apache mysql]# mysql -uzabbix -p'zabbix123!' zabbix < images.sql 
mysql: [Warning] Using a password on the command line interface can be insecure.
[root@apache mysql]# mysql -uzabbix -p'zabbix123!' zabbix < data.sql 
mysql: [Warning] Using a password on the command line interface can be insecure.
//编译
[root@apache mysql]#  ./configure 
--enable-server
--enable-agent 
--with-mysql
 --with-net-snmp 
 --with-libcurl 
 --with-libxml2
[root@apache zabbix-5.4.4]#  make install

zabbix服务端配置
[root@apache zabbix-5.4.4]#  ls /usr/local/etc/
zabbix_agentd.conf  zabbix_agentd.conf.d  zabbix_server.conf  zabbix_server.conf.d
//修改服务端配置文件
//设置数据库信息
[root@apache zabbix-5.4.4]# vim /usr/local/etc/zabbix_server.conf
DBPassword=zabbix123!       //设置zabbix数据库连接密码
[root@apache zabbix-5.4.4]# zabbix_server
[root@apache zabbix-5.4.4]# zabbix_agentd
[root@apache zabbix-5.4.4]# ss -anlit
State     Recv-Q    Send-Q       Local Address:Port        Peer Address:Port                      
LISTEN    0         128                0.0.0.0:10050            0.0.0.0:*      
         cubic cwnd:10   
LISTEN    0         128              127.0.0.1:9000             0.0.0.0:*      
         cubic cwnd:10   
LISTEN    0         80                       *:3306                   *:*      
         cubic cwnd:10   
LISTEN    0         128                      *:80                     *:*      


如果发现启动不了10051端口,说明zabbix找不到mysql位置要手动指定,修改zabbix配置文件。

[root@apache zabbix-5.4.4]# vim /usr/local/etc/zabbix_server.conf
DBSocket=/tmp/mysql.sock
[root@apache zabbix-5.4.4]# zabbix_server
[root@apache zabbix-5.4.4]# zabbix_agentd
[root@apache zabbix-5.4.4]#  ss -anlt
State       Recv-Q      Send-Q             Local Address:Port              Peer Address:Port      
LISTEN      0           128                      0.0.0.0:111                    0.0.0.0:*         
LISTEN      0           32                 192.168.122.1:53                     0.0.0.0:*         
LISTEN      0           128                      0.0.0.0:22                     0.0.0.0:*         
LISTEN      0           5                      127.0.0.1:631                    0.0.0.0:*         
LISTEN      0           128                      0.0.0.0:10050                  0.0.0.0:*         
LISTEN      0           128                      0.0.0.0:10051                  0.0.0.0:*         
LISTEN      0           128                    127.0.0.1:9000                   0.0.0.0:*         
LISTEN      0           80                             *:3306                         *:*         
LISTEN      0           128                         [::]:111                       [::]:*         
LISTEN      0           128                            *:80                           *:*         
LISTEN      0           128                         [::]:22                        [::]:*         
LISTEN      0           5                          [::1]:631                       [::]:*         
Zabbix服务端web界面安装与配置
[root@apache zabbix-5.4.4]# sed -ri 's/(post_max_size =).*/1 16M/g' /etc/php.ini
[root@apache zabbix-5.4.4]# sed -ri 's/(max_execution_time =).*/1 300/g' /etc/php.ini
[root@apache zabbix-5.4.4]# sed -ri 's/(max_input_time =).*/1 300/g' /etc/php.ini
[root@apache zabbix-5.4.4]# sed -i '/;date.timezone/a date.timezone = Asia/Shanghai' /etc/php.ini

//将Zabbix目录中的前端网页复制到php存放网页的目录
[root@apache zabbix-5.4.4]# cd /usr/src/zabbix-5.4.4/
[root@apache zabbix-5.4.4]# ls
aclocal.m4  compile        config.sub    depcomp     Makefile     missing  ui
AUTHORS     conf           configure     include     Makefile.am  NEWS     zabbix.service
bin         config.guess   configure.ac  INSTALL     Makefile.in  README
build       config.log     COPYING       install-sh  man          sass
ChangeLog   config.status  database      m4          misc         src
[root@apache zabbix-5.4.4]# mkdir /usr/local/apache/htdocs/zabbix
[root@apache zabbix-5.4.4]# cp -r ui/* /usr/local/apache/htdocs/zabbix/
[root@apache zabbix-5.4.4]# chown -R apache.apache /usr/local/apache/htdocs/
//配置apache虚拟主机
[root@apache zabbix-5.4.4]# vim /usr/local/apache/conf/httpd.conf 

    documentRoot "/usr/local/apache/htdocs/zabbix"
    ServerName www.hhr.com
    ProxyRequests Off
    ProxyPassMatch ^/(.*.php)$ fcgi://127.0.0.1:9000/usr/local/apache/htdocs/zabbix/
    
        Options none
        AllowOverride none
        Require all granted
    
 
//修改/usr/local/apache/htdocs/zabbix/conf的权限,这样才能自动生成数据库连接文件
[root@apache zabbix-5.4.4]# chmod 777 /usr/local/apache/htdocs/zabbix/conf
[root@apache zabbix-5.4.4]# ll -d /usr/local/apache/htdocs/zabbix/conf
[root@apache zabbix-5.4.4]# systemctl restart httpd.service
[root@apache zabbix-5.4.4]# service php-fpm restart
Gracefully shutting down php-fpm . done
Starting php-fpm  done
[root@apache zabbix-5.4.4]#  service mysqld restart
Shutting down MySQL.... SUCCESS! 
Starting MySQL. SUCCESS! 
[root@apache zabbix-5.4.4]# ss -anlt
State       Recv-Q      Send-Q             Local Address:Port              Peer Address:Port      
LISTEN      0           128                      0.0.0.0:111                    0.0.0.0:*         
LISTEN      0           32                 192.168.122.1:53                     0.0.0.0:*         
LISTEN      0           128                      0.0.0.0:22                     0.0.0.0:*         
LISTEN      0           5                      127.0.0.1:631                    0.0.0.0:*         
LISTEN      0           128                      0.0.0.0:10050                  0.0.0.0:*         
LISTEN      0           128                      0.0.0.0:10051                  0.0.0.0:*         
LISTEN      0           128                    127.0.0.1:9000                   0.0.0.0:*         
LISTEN      0           80                             *:3306                         *:*         
LISTEN      0           128                         [::]:111                       [::]:*         
LISTEN      0           128                            *:80                           *:*         
LISTEN      0           128                         [::]:22                        [::]:*         
LISTEN      0           5                          [::1]:631                       [::]:*         
安装zabbix web界面









转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/277731.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号