首页 > 其他分享 >zabbix安装

zabbix安装

时间:2022-10-09 14:55:14浏览次数:33  
标签:安装 rh3 repo zabbix yum MariaDB root

zabbix安装

一、部署lamp

  1. 首先配置yum网络仓库,更换centos源和epel源,这里使用阿里云

    [root@rh3 ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
    [root@rh3 ~]# sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
    [root@rh3 ~]# yum install -y https://mirrors.aliyun.com/epel/epel-release-latest-8.noarch.rpm
    [root@rh3 ~]# sed -i 's|^#baseurl=https://download.example/pub|baseurl=https://mirrors.aliyun.com|' /etc/yum.repos.d/epel*
    [root@rh3 ~]# sed -i 's|^metalink|#metalink|' /etc/yum.repos.d/epel*
    [root@rh3 ~]# ls /etc/yum.repos.d/
    CentOS-Base.repo  epel-modular.repo  epel.repo  epel-testing-modular.repo  epel-testing.repo  redhat.repo
    
    
  2. 安装httpd、php、mariadb这里使用yum安装

    [root@rh3 ~]# yum -y install httpd
    [root@rh3 ~]# yum -y install php*
    [root@rh3 ~]# yum -y install mariadb*
    
  3. 设置数据库服务

    [root@rh3 ~]# vim /etc/php.ini		#设置时区
    date.timezone = Asia/Shanghai
    [root@rh3 ~]# systemctl restart mariadb.service 		#启动服务
    [root@rh3 ~]# systemctl enable mariadb.service 		#设置开机自启
    [root@rh3 ~]# mysql
    MariaDB [(none)]> set password = password('redhat');		#修改密码为redhat
    Query OK, 0 rows affected (0.001 sec)
    
  4. 设置httpd服务

    [root@rh3 ~]# vim /etc/httpd/conf/httpd.conf 
    #搜索dir_module
    ***省略***
    <IfModule dir_module>
        DirectoryIndex index.html index.php		#添加index.php
    </IfModule>
    ***省略***
    [root@rh3 ~]# systemctl enable --now httpd		#设置开机自启并立即执行
    
  5. 测试php页面

    [root@rh3 ~]# vim /etc/php.ini
    #搜索date
    ; http://php.net/date.timezone
    date.timezone = Asia/Shanghai		#取消此行注释并添加上海时区
    [root@rh3 ~]# vim /var/www/html/index.php
    <?php
    	phpinfo();
    ?>
    
  6. 验证

    [root@rh3 ~]# firewall-cmd --add-port=80/tcp 		#先放行80端口
    

    image-20220901145042917

二、安装zabbix

  1. 配置zabbix网络仓库

    [root@rh3 ~]# vim /etc/yum.repos.d/zabbix.repo
    [aliyun]
    name=aliyun
    baseurl=https://mirrors.aliyun.com/zabbix/zabbix/4.4/rhel/8/x86_64/
    enable=1
    gpgcheck=0
    
    [qinghua]
    name=Zabbix Official Repository - $basearch
    baseurl=https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.4/rhel/8/$basearch/
    enabled=1
    gpgcheck=0
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
    
    
  2. 安装所需软件包

    [root@rh3 ~]# dnf -y install zabbix-server-mysql zabbix-web-mysql zabbix-apache-conf zabbix-agent
    
  3. 配置数据库并导入zabbix数据

    [root@rh3 ~]# mysql -u root -p 
    Enter password: 
    Welcome to the MariaDB monitor.  Commands end with ; or \g.
    Your MariaDB connection id is 17
    Server version: 10.3.28-MariaDB MariaDB Server
    
    Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
    Query OK, 1 row affected (0.002 sec)
    MariaDB [(none)]> grant all on zabbix.* to zabbix@'localhost' identified by 'redhat';
    Query OK, 1 row affected (0.002 sec)
    MariaDB [(none)]> flush privileges;
    Query OK, 1 row affected (0.002 sec)
    [root@rh3 ~]# zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql -u zabbix -predhat zabbix
    
  4. 验证数据库数据

    MariaDB [zabbix]> use zabbix;
    Database changed
    MariaDB [zabbix]> show tables;
    +----------------------------+
    | Tables_in_zabbix           |
    +----------------------------+
    | acknowledges               |
    | actions                    |
    | alerts                     |
    | application_discovery      |
    | application_prototype      |
    | application_template       |
    | applications               |
    | auditlog                   |
    | auditlog_details           |
    ***省略***
    
  5. 配置zabbix并启动,管理员账号:Admin 密码:zabbix

    [root@rh3 ~]# vim /etc/zabbix/zabbix_server.conf 		#编辑配置文件
    #搜索并删除注释,补充没有的地方
    ListenPort=10051 
    DBHost=localhost 
    DBName=zabbix 
    DBUser=zabbix 
    DBPassword=redhat            
    DBSocket=/var/lib/mysql/mysql.sock 
    ListenIP=0.0.0.0 
    [root@rh3 ~]# systemctl restart zabbix-server.service 		#启动并设置开机自启
    [root@rh3 ~]# systemctl enable zabbix-server.service 
    
    

    image-20220901163933451

image-20220901164903790

标签:安装,rh3,repo,zabbix,yum,MariaDB,root
From: https://www.cnblogs.com/Archer-x/p/16772090.html

相关文章

  • 安装JDK以及配置环境(保姆级)
    1、去官网下载 https://www.oracle.com   往下拉找到java  找到JDK 找到它  找到它   找版本  然后找到对应操作系统的版本下载 ......
  • VS2019 下载NUGet包 本地安装 但没有成功
    1、下载:在网址https://www.nuget.org/中找对应的包版本 2、新建程序包源地址,其地址设置为下载的本地包地址:E:\NuGet离线包;点击更新   3、在程序包管理控制......
  • lnpm php7.4 安装ssh2扩展
    SSH2安装小编以前没有做过,今天听一个朋友说要在centos中使用SSH2了,下面我们来为各位介绍linux系统中安装SSH2扩展步骤详解吧,今天闲来无事,给大伙说一下linux下安装SSH2......
  • 手把手教你玩转 Gitea|在 Windows 系统上安装 Gitea
    Gitea支持在Windows系统上安装和使用。Gitea本身作为一个单体应用程序,即点即用,如需长期驻留作为后台服务并开机运行就要依靠Windows服务工具sc.exe。通过本文,你将......
  • zookeeper下载安装(base)
    1,获取,Apache官网下载 http://zookeeper.apache.org/releases.html我下载下来的,放在网盘上了地址: http://pan.baidu.com/s/1bnm21Jp2,解压出来 tarxvf zookeeper-3.4.......
  • Linux中安装使用rsync
    获取 rsync-3.1.0 我的网盘里放了一个。地址:​​http://pan.baidu.com/s/1dDs4lSt​​安装rsync-3.1.0.tar.gz #tarzxvfrsync-3.1.0.tar.gz#cdrsync-3.1.0#./config......
  • MQTT服务端安装ubuntu
    https://blog.csdn.net/weixin_43850980/article/details/122217933MQTT安装发送订阅terminalmosquitto_pub-t"test"-m"msssss测试内容"接收订阅terminalmosquitto_......
  • CnetOS 7.9 安装 sqlite3
    一、CnetOS7.9安装sqlite3地址https://www.sqlite.orghttps://github.com/sqlite/sqlitehttps://www.sqlite.org/2022/sqlite-autoconf-3390400.tar.gz wg......
  • CentOS 7.9 安装 django-3.2.10
    一、CentOS7.9安装django-3.2.10地址https://www.djangoproject.comhttps://github.com/django/django二、安装django先得安装pythonpython3python3-Vpip3-......
  • pip 安装
    ​​PythonPackageIndex​​ Python包序列,这个软件是PyPA推荐的安装Python包的工具。安装方法:1,进入https://pypi.python.org/pypi/pip官网2,下载压缩包 ​​pip-6.0......