美文网首页
centos7快速yum安装zabbix4.4

centos7快速yum安装zabbix4.4

作者: 逗比的一生 | 来源:发表于2021-01-08 10:44 被阅读0次

    步骤一:

    1. 安装mysql

    首先移除mariadb
    yum remove mariadb-libs.x86_64
    安装mysql的源

    wget https://repo.mysql.com//mysql80-community-release-el7-2.noarch.rpm
    yum localinstall mysql80-community-release-el7-2.noarch.rpm 
    

    安装yum-config-manager,然后修改要安装的mysql版本为5.7

    [root@freesaber tmp]# yum search yum-config-manager
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
    ========================================== Matched: yum-config-manager ==========================================
    yum-utils.noarch : Utilities based around the yum package manager
    [root@freesaber tmp]# yum install yum-utils.noarch
    
    yum-config-manager --disable mysql80-community
    yum-config-manager --enable mysql57-community
    

    安装mysql5.7数据库

    yum install mysql-community-server
    

    启动数据库

    systemctl start mysqld.service
    systemctl status mysqld.service
    

    查看数据库初始密码
    grep "password" /var/log/mysqld.log

    登录mysql数据库修改初始密码
    mysql -uroot -p
    ALTER USER 'root'@'localhost' IDENTIFIED BY 'PASSWORD';
    注:mysql5.7默认对密码复杂度有要求

    查看root账户,修改root账户,允许任何主机进行连接

    mysql> use mysql;
    Database changed
    mysql> select Host,User from user \G;
    *************************** 1. row ***************************
    Host: localhost
    User: mysql.infoschema
    *************************** 2. row ***************************
    Host: localhost
    User: mysql.session
    *************************** 3. row ***************************
    Host: localhost
    User: mysql.sys
    *************************** 4. row ***************************
    Host: localhost
    User: root
    4 rows in set (0.00 sec)
    
    mysql> update user set Host = '%' where Host = 'localhost' and User = 'root';
    Query OK, 1 row affected (0.04 sec)
    Rows matched: 1  Changed: 1  Warnings: 0
    
    mysql> select Host,User from user \G;
    *************************** 1. row ***************************
    Host: %
    User: root
    *************************** 2. row ***************************
    Host: localhost
    User: mysql.infoschema
    *************************** 3. row ***************************
    Host: localhost
    User: mysql.session
    *************************** 4. row ***************************
    Host: localhost
    User: mysql.sys
    4 rows in set (0.00 sec)
    

    刷新权限
    FLUSH PRIVILEGES;

    步骤二:

    1.安装zabbix

    由于zabbix官方网站在国内下载比较慢,而且yum安装用zabbix官方源经常安装失败,我们使用阿里的镜像站。

    rpm -Uvh https://mirrors.aliyun.com/zabbix/zabbix/4.4/rhel/7/x86_64/zabbix-release-4.4-1.el7.noarch.rpm

    下载安装后/etc/yum.repo目录下会生成zabbix.repo文件,修改zabbix.repo文件,更换yum源为aliyun。

    cat /etc/yum.repos.d/zabbix.repo
    [zabbix]
    name=Zabbix Official Repository - $basearch
    baseurl=https://mirrors.aliyun.com/zabbix/zabbix/4.4/rhel/7/x86_64/
    enabled=1
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
    [zabbix-debuginfo]
    name=Zabbix Official Repository debuginfo - $basearch
    baseurl=https://mirrors.aliyun.com/zabbix/zabbix/4.4/rhel/7/x86_64/debuginfo/
    enabled=0
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
    gpgcheck=1
    [zabbix-non-supported]
    name=Zabbix Official Repository non-supported - $basearch
    baseurl=https://mirrors.aliyun.com/zabbix/zabbix/4.4/rhel/7/x86_64/
    enabled=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
    gpgcheck=1
    

    或者清华软件源

    [zabbix]
    name=Zabbix Official Repository - $basearch
    baseurl=https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.4/rhel/7/x86_64/
    enabled=1
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
    
    [zabbix-debuginfo]
    name=Zabbix Official Repository debuginfo - $basearch
    baseurl=https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.4/rhel/7/x86_64/debuginfo/
    enabled=0
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
    gpgcheck=1
    
    [zabbix-non-supported]
    name=Zabbix Official Repository non-supported - $basearch
    baseurl=https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.4/rhel/7/x86_64/
    enabled=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
    gpgcheck=1
    

    安装fping,以免出错
    yum list | grep epel-release
    yum remove epel-release
    yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
    yum install -y iksemel fping libiksemel net-snmp-utils

    安装zabbix-server、agent和apache
    yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-apache-conf zabbix-agent zabbix-get

    2.配置zabbix

    创建初始数据库

    # mysql -uroot -p
    
    mysql> create database zabbix character set utf8 collate utf8_bin;
    
    mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'PASSWORD';
    
    mysql> quit;
    

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

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

    为Zabbix server配置数据库,编辑配置文件 /etc/zabbix/zabbix_server.conf

    vim /etc/zabbix/zabbix_server.conf
    修改此行 DBPassword=Password
    

    配置PHP上海时区,编辑配置文件

    vim /etc/httpd/conf.d/zabbix.conf
    修改此行 php_value date.timezone Asia/Shanghai
    
    vi /etc/php.ini
    修改此行 date.timezone = Asia/Shanghai  
    

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

    systemctl start zabbix-server zabbix-agent httpd
    
    systemctl enable zabbix-server zabbix-agent httpd
    

    登录并配置zabbix前端,注意配置zabbix数据库密码,其他全部下一步即可


    image

    登录zabbix页面,默认用户为Admin,密码为zabbix,用yum安装zabbix的路径是http://x.x.x.x/zabbix/

    这里放个连接,文章是以mariabd作为后段数据库,其他无太多区别
    https://www.cnblogs.com/ysuwangqiang/p/11988314.html

    相关文章

      网友评论

          本文标题:centos7快速yum安装zabbix4.4

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