zoukankan      html  css  js  c++  java
  • CentOS7安装zabbix5.0

    1.设置上网代理

    vim /etc/yum.conf
    添加:
    proxy = http://IP:PORT
    
    vim /etc/wgetrc    
    添加:
    http_proxy = http://IP:PORT
    https_proxy = http://IP:PORT
    ftp_proxy = http://IP:PORT
    

    2.获取阿里yum安装所需依赖

    mv /etc/yum.repos.d /etc/yum.repos.d.bak
    mkdir /etc/yum.repos.d
    cd /etc/yum.repos.d
    wget http://mirrors.aliyun.com/repo/Centos-7.repo
    yum install libodbc.so.2
    yum install libOpenIPMI.so.0
    在如下网址获取mailcap安装包并上传至服务器
    http://mirrors.aliyun.com/centos/7/os/x86_64/Packages/mailcap-2.1.41-2.el7.noarch.rpm
    rpm -ivh mailcap-2.1.41-2.el7.noarch.rpm
    yum install httpd

    3.获取安装zabbix

    wget https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
    rpm -Uvh zabbix-release-5.0-1.el7.noarch.rpm
    yum clean all
    yum install zabbix-server-mysql zabbix-agent
    yum install centos-release-scl
    

      启用zabbix前端存储库

    vim /etc/yum.repos.d/zabbix.repo
    
    [zabbix-frontend]
    ...
    enabled=1
    ...
    

     继续安装,此时先删除阿里yum文件

    rm -f Centos-7.repo
    yum install zabbix-web-mysql-scl zabbix-apache-conf-scl

    4.安装mysql

    wget http://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
    yum -y install mysql80-community-release-el7-3.noarch.rpm
    yum -y install mysql-community-server
    这步要稍微等下,安装完成后就会覆盖掉自带的mariadb
    启动mysql
    systemctl start mysqld
    systemctl status mysqld
    systemctl enable mysqld

     mysql安装完成之后,在/var/log/mysqld.log文件中给root生成了一个默认密码。通过 grep 'temporary password' /var/log/mysqld.log找到root默认密码,然后登录mysql进行修改: mysql -u root -p

    mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Password.2021';
    

     创建zabbix数据库并授权远程连接

    mysql> create database zabbix character set utf8 collate utf8_bin;
    Query OK, 1 row affected, 2 warnings (0.01 sec)
     
    mysql> create user zabbix@localhost identified by 'Zabbix.1';
    Query OK, 0 rows affected (0.01 sec)
     
    mysql> grant all privileges on zabbix.* to zabbix@localhost;
    Query OK, 0 rows affected (0.00 sec)
     
    mysql> show databases;
    +--------------------+
    | Database           |
    +--------------------+
    | information_schema |
    | mysql              |
    | performance_schema |
    | sys                |
    | zabbix             |
    +--------------------+
    5 rows in set (0.05 sec)
    mysql> use mysql
    Reading table information for completion of table and column names
    You can turn off this feature to get a quicker startup with -A
     
    Database changed
    mysql> select host, user, authentication_string, plugin from user;
    +-----------+------------------+------------------------------------------------------------------------+-----------------------+
    | host | user | authentication_string | plugin |
    +-----------+------------------+------------------------------------------------------------------------+-----------------------+
    | localhost | mysql.infoschema | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED | caching_sha2_password |
    | localhost | mysql.session | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED | caching_sha2_password |
    | localhost | mysql.sys | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED | caching_sha2_password |
    | localhost | root | $A$005$7r_q<a#o%X"x&]dDnJU5m.sEwWCYUXkSERLSPQkvyUgCoyhptq/BSBq6wC | caching_sha2_password |
    | localhost | zabbix | $A$005$Z{YsyZNsMvBdOiTyseP//twfjP2adpwAotGTt4FXAFb5segRN5 | caching_sha2_password |
    +-----------+------------------+------------------------------------------------------------------------+-----------------------+
    5 rows in set (0.00 sec)
     
    mysql> update user set host = "%" where user='zabbix';
    Query OK, 1 row affected (0.00 sec)
    Rows matched: 1 Changed: 1 Warnings: 0
     
    mysql> flush privileges;
    Query OK, 0 rows affected (0.01 sec)
     
    mysql> select host, user, authentication_string, plugin from user;
    +-----------+------------------+------------------------------------------------------------------------+-----------------------+
    | host | user | authentication_string | plugin |
    +-----------+------------------+------------------------------------------------------------------------+-----------------------+
    | % | zabbix | $A$005$Z{YsyZNsMvBdOiTyseP//twfjP2adpwAotGTt4FXAFb5segRN5 | caching_sha2_password |
    | localhost | mysql.infoschema | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED | caching_sha2_password |
    | localhost | mysql.session | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED | caching_sha2_password |
    | localhost | mysql.sys | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED | caching_sha2_password |
    | localhost | root | $A$005$7r_q<a#o%X"x&]dDnJU5m.sEwWCYUXkSERLSPQkvyUgCoyhptq/BSBq6wC | caching_sha2_password |
    +-----------+------------------+------------------------------------------------------------------------+-----------------------+
    5 rows in set (0.00 sec)
     
    mysql> alter USER 'zabbix'@'%' IDENTIFIED WITH mysql_native_password BY 'Zabbix.1';
    Query OK, 0 rows affected (0.00 sec)
     
    mysql> flush privileges;
    Query OK, 0 rows affected (0.01 sec)
    

     导入初始架构和数据,系统将提示您输入新创建的密码

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

     为Zabbix server配置数据库

    vim /etc/zabbix/zabbix_server.conf
    DBPassword=Zabbix.1
    

     为Zabbix前端配置PHP

    vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
    ; php_value[date.timezone] = Europe/Riga
    改为
    php_value[date.timezone] = Asia/Taipei
    

     启动Zabbix server和agent进程,并设置开机自启

    systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm
    systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm
    

     连接到新安装的Zabbix前端: http://server_ip_or_name/zabbix

      

  • 相关阅读:
    使用yum 安装时出现 : Loaded plugins: fastestmirror
    三级店铺发布店铺悬赏必看
    专属包发布说明
    发布店铺内容(原封不动的直接复制内容发布就可以)
    tomcat 专属图片文件夹配置
    java websocket时时通信
    lua面向对象
    jenkins 查看请求调用栈信息
    从一个简单的例子看spring ApplicationContext上下文隔离
    java异常查看利器之使用 jvmti 的Callback_JVMTI_EVENT_EXCEPTION 事件查看异常
  • 原文地址:https://www.cnblogs.com/taihao/p/15089800.html
Copyright © 2011-2022 走看看