zabbix 5.0 LTS版本的安装

我这次的安装环境:

zabbix:5.0 LTS版;
操作系统:centos 7;
数据库:mysql 5.7(建议不要用版本8,会碰到很多故障,比如加密方式等,我们就存储个监控数据,不需要那么新,用5.7版即可,而且这个版本也是比较推荐的版本)。

整体安装流程,其实也就2步:

1、安装mysql数据库:
2、安装zabbix:根据下面这个链接选择自己的系统版本,然后会生成对应的操作步骤,根据说明操作即可。
https://www.zabbix.com/cn/download?zabbix=5.0&os_distribution=centos&os_version=7&db=mysql&ws=apache

详细步骤:

写在前面:最好把centos的selinux和Firewall关掉,能避免很多问题。如果你觉得不安全,可以这样安装成功后,再打开他们,并设置想要的放行规则即可。

systemctl status firewalld.service  #查询防火墙当前状态
systemctl stop firewalld.service   #临时禁用防火墙,下次重启系统会恢复
systemctl disable firewalld.service  #永久禁用防火墙

[root@localhost ~]# getenforce   #查询当前selinux状态。
Enforcing
[root@localhost ~]# setenforce 0  #临时关闭selinux。
[root@localhost ~]# 
[root@localhost ~]# getenforce 
Permissive
永久关闭selinux需要修改配置文件:/etc/selinux/config
[root@localhost ~]# vi /etc/selinux/config

# This file controls the state of SELinux on the system.

# SELINUX= can take one of these three values:

#     enforcing - SELinux security policy is enforced.

#     permissive - SELinux prints warnings instead of enforcing.

#     disabled - No SELinux policy is loaded.

SELINUX=enforcing         修改为"SELINUX=disabled"

# SELINUXTYPE= can take one of three values:

#     targeted - Targeted processes are protected,

#     minimum - Modification of targeted policy. Only selected processes are protected.

#     mls - Multi Level Security protection.

SELINUXTYPE=targeted
————————————————
版权声明:本文为CSDN博主「neo_will_mvp」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_33468857/article/details/124489504

1、安装mysql:官网:https://downloads.mysql.com/archives/community/
(按下面的命令顺序操作,或者参考这篇文章:https://blog.csdn.net/Tiger_Paul/article/details/123044609

[root@localhost~]wget https://downloads.mysql.com/archives/get/p/23/file/mysql-5.7.37-1.el7.x86_64.rpm-bundle.tar
[root@localhost~]# rpm -aq | grep mariadb
mariadb-libs-5.5.68-1.el7.x86_64
[root@localhost~]# rpm -e mariadb-libs-5.5.68-1.el7.x86_64 --nodeps
[root@localhost~]# tar -xvf mysql-5.7.37-1.el7.x86_64.rpm-bundle.tar -C /tmp
[root@localhost tmp]# cd /tmp/
建议按顺序安装:common --> libs --> clients --> server
[root@localhost tmp]# rpm -ivh mysql-community-libs-compat-5.7.37-1.el7.x86_64.rpm   
#一个都不能少,不然后面会出问题。这个如果不装,在执行zabbix教程中的:zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix整条命令时,会报错:no such file or directory。此时,只需要补充安装这个包即可。
[root@localhost tmp]# rpm -ivh mysql-community-common-5.7.37-1.el7.x86_64.rpm
[root@localhost tmp]# rpm -ivh mysql-community-libs-5.7.37-1.el7.x86_64.rpm
[root@localhost tmp]# rpm -ivh mysql-community-client-5.7.37-1.el7.x86_64.rpm 
[root@localhost tmp]# rpm -ivh mysql-community-server-5.7.37-1.el7.x86_64.rpm

2、查看mysql是否安装好了

[root@localhost ~]# which mysql  #看下mysql安装到哪里了?
/usr/bin/mysql
[root@localhost ~]# systemctl start mysqld  #启动mysql服务
[root@localhost ~]# systemctl status mysqld  #查看mysql运行状态
● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2022-07-08 10:54:53 CST; 5s ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 4660 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)
  Process: 4602 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
 Main PID: 4663 (mysqld)
    Tasks: 27
   CGroup: /system.slice/mysqld.service
           └─4663 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid

Jul 08 10:54:48 localhost.localdomain systemd[1]: Starting MySQL Server...
Jul 08 10:54:53 localhost.localdomain systemd[1]: Started MySQL Server.
[root@localhost ~]# 
[root@localhost ~]# cat /var/log/mysqld.log | grep password  #查看mysql初始密码
2022-07-08T02:54:51.847741Z 1 [Note] A temporary password is generated for root@localhost: JkU;NHsqA362
[root@localhost ~]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.37

Copyright (c) 2000, 2022, 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>             #成功进入mysql,先把密码改了。
mysql> set password for root@localhost = password('你自己的密码');

#查看mysql当前用户及加密规则,mysql18之前的版本的加密规则是mysql_native_password,但是mysql18的是caching_sha2_password。
#修改加密规则的方式(但我们不需要):ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '你自己的密码';

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 user,host,plugin from mysql.user;
+---------------+-----------+-----------------------+
| user          | host      | plugin                |
+---------------+-----------+-----------------------+
| root          | localhost | mysql_native_password |
| mysql.session | localhost | mysql_native_password |
| mysql.sys     | localhost | mysql_native_password |
+---------------+-----------+-----------------------+
3 rows in set (0.00 sec)

mysql> 
mysql> flush privileges;  #刷新权限
mysql> exit  #退出数据库状态
Bye
[root@localhost ~]#

mysql数据库安装到此完成,下面就开始安装zabbix。

安装zabbix比较简单,按照下面这个官方文档复制粘贴命令即可:
https://www.zabbix.com/cn/download?zabbix=5.0&os_distribution=centos&os_version=7&db=mysql&ws=apache

如果你严格按照我上面说的做,在安装zabbix的时候是不会出任何问题的。好,到此zabbix就安装好了,下面就可以用ip登录zabbix了!

如果出现时区问题,可以重新修改timezone,把前面的那个分号去掉。然后在重启下相关服务:

[root@localhost ~]# systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm

做好步骤g后,就可以了,然后根据这个:https://www.zabbix.com/documentation/5.0/zh/manual/quickstart/login,登录zabbix。初始管理员为:Admin,密码:zabbix。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 221,273评论 6 515
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 94,349评论 3 398
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 167,709评论 0 360
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 59,520评论 1 296
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 68,515评论 6 397
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 52,158评论 1 308
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 40,755评论 3 421
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 39,660评论 0 276
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 46,203评论 1 319
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 38,287评论 3 340
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 40,427评论 1 352
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 36,122评论 5 349
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 41,801评论 3 333
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 32,272评论 0 23
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 33,393评论 1 272
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 48,808评论 3 376
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 45,440评论 2 359

推荐阅读更多精彩内容