1. 配置阿里云源
參考鏈接: https://developer.aliyun.com/mirror
2. 使用阿里云源安裝mariadb
dbf -y install mariadb-server mariadb-client
systemctl start mariadb #啟動(dòng)MariaDB
systemctl stop mariadb #停止MariaDB
systemctl restart mariadb #重啟MariaDB
systemctl enable mariadb #設(shè)置開機(jī)啟動(dòng)
MySQL_secure_installation
[root@m01 ~]# rpm -Uvh https://repo.zabbix.com/zabbix/4.5/rhel/8/x86_64/zabbix-release-4.5-2.el8.noarch.rpm
或
[root@m01 ~]# rpm -Uvh https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.5/rhel/8/x86_64/zabbix-release-4.5-2.el8.noarch.rpm
[root@m01 ~]# dnf clean all
dnf -y install zabbix-server-mysql zabbix-web-mysql zabbix-nginx-conf zabbix-agent
如果出現(xiàn)以下報(bào)錯(cuò);
dnf -y install zabbix-server-mysql zabbix-web-mysql zabbix-nginx-conf zabbix-agent
Last metadata expiration check: 0:00:45 ago on Fri 13 Mar 2020 04:29:48 PM CST.
Error:
Problem: cannot install the best candidate for the job
- nothing provides libssh3.so.1()(64bit) needed by zabbix-server-mysql-5.0.0-0.2alpha2.el8.x86_64
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)
解決方法:
手動(dòng)安裝libssh3
dnf -y install http://mirror.centos.org/centos/8.0.1905/AppStream/x86_64/os/Packages/libssh3-1.8.0-8.module_el8.0.0+189+f9babebb.1.x86_64.rp
注意:nginx軟件包在官方存儲(chǔ)庫中不可用??梢栽趀pel資料庫中找到。
創(chuàng)新互聯(lián)建站是專業(yè)的海興網(wǎng)站建設(shè)公司,海興接單;提供成都網(wǎng)站設(shè)計(jì)、成都網(wǎng)站建設(shè),網(wǎng)頁設(shè)計(jì),網(wǎng)站設(shè)計(jì),建網(wǎng)站,PHP網(wǎng)站建設(shè)等專業(yè)做網(wǎng)站服務(wù);采用PHP框架,可快速的進(jìn)行海興網(wǎng)站開發(fā)網(wǎng)頁制作和功能擴(kuò)展;專業(yè)做搜索引擎喜愛的網(wǎng)站,專業(yè)的做網(wǎng)站團(tuán)隊(duì),希望更多企業(yè)前來合作!
dnf -y install epel-release
[root@centos8 ~]# mysql -u root -p
Enter password:
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.000 sec)
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@'%' identified by 'zabbix';
Query OK, 0 rows affected (0.008 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.008 sec)
[root@centos8 ~]# zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql -u zabbix -p zabbix
Enter password:
編輯/etc/zabbix/zabbix_server.conf 文件, 修改數(shù)據(jù)庫配置
[root@centos8 ~]# cat /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
編輯/etc/nginx/conf.d/zabbix.conf,取消注釋并設(shè)置'listen'和'server_name'指令
listen 80;
server_name 192.168.0.111;
編輯文件/etc/php-fpm.d/zabbix.conf,取消注釋并設(shè)置正確的時(shí)區(qū)
php_value[date.timezone] = Asia/Shanghai
注意: 必須關(guān)閉防火墻firewalld和selinux**(非常重要)**
[root@centos8 ~]# systemctl restart zabbix-server zabbix-agent nginx php-fpm
[root@centos8 ~]# systemctl enable zabbix-server zabbix-agent nginx php-fpm
提示已成功地安裝了 Zabbix 前端。配置文件/etc/zabbix/web/zabbix.conf.php 被創(chuàng)建。
默認(rèn)登錄zabbixweb的用戶名:Admin, 密碼:zabbix
如果沒有安裝中文字體包,使用dnf安裝"langpacks-zh_CN.noarch"
修復(fù)中文亂碼的解決方法:
安裝字體并替換現(xiàn)有字體
[root@centos8 ~]# dnf -y install wqy-microhei-fonts
[root@centos8 ~]# cp /usr/share/fonts/wqy-microhei/wqy-microhei.ttc /usr/share/zabbix/assets/fonts/graphfont.ttf
我這里使用的監(jiān)控主機(jī)是ubuntu18.04
root@ubuntu:~# apt-get install zabbix-agent
root@ubuntu:~# vim /etc/zabbix/zabbix_agentd.conf
PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=0
Server=192.168.0.111
ServerActive=192.168.0.111
Hostname=Zabbix server
Include=/etc/zabbix/zabbix_agentd.d/*.conf
root@ubuntu:~# systemctl start zabbix-agent.service
root@ubuntu:~# systemctl enable zabbix-agent.service
root@ubuntu:~# netstat -ntlp |grep 10050
tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN 5662/zabbix_agentd
tcp6 0 0 :::10050 :::* LISTEN 5662/zabbix_agentd