侧边栏壁纸
博主头像
福福不服博主等级

孩子会穿过大雨,去懂人间的道理。

  • 累计撰写 77 篇文章
  • 累计创建 91 个标签
  • 累计收到 0 条评论

目 录CONTENT

文章目录

Linux搭建Zabbix5.0

Monster
2023-07-03 / 0 评论 / 0 点赞 / 21 阅读 / 6443 字 / 正在检测是否收录...
温馨提示:
请确保在评论和互动中保持礼貌和尊重。避免使用侮辱性、歧视性或攻击性语言。我们鼓励建设性的讨论和意见交流。

Linux搭建Zabbix5.0

获取zabbix下载源

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

将repo.zabbix.com替换成阿里云

vim /etc/yum.repos.d/zabbix.repo

安装服务端

yum install zabbix-server-mysql zabbix-agent -y

安装扩展插件

yum install centos-release-scl -y

修改zabbix-frontend前端源,将enable=0修改成1

vim /etc/yum.repos.d/zabbix.repo 

安装zabbix前端环境

yum install zabbix-web-mysql-scl zabbix-apache-conf-scl -y

安装zabbix mariadb数据库

yum install mariadb-server -y

配置数据库并设置开机启动

systemctl enable --now mariadb

初始化数据库,设置密码:mysql_secure_installation

[root@localhost ~]# mysql_secure_installation 

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] n
 ... skipping.

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

添加数据库用户,设置密码

mysql -uroot -p

MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> create user zabbix@localhost identified by 'xxxxxx';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> exit;
Bye

导入数据库信息

[root@localhost ~]# zcat /usr/share/doc/zabbix-server-mysql-5.0.28/create.sql.gz | mysql -uzabbix -p zabbix
Enter password: 
[root@localhost ~]# 

修改zabbix server配置文件,设置数据库密码

vim /etc/zabbix/zabbix_server.conf 

找到DBPassword,取消注释设置密码

修改zabbix php配置文件

vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf

将时区改成大陆时间

启动zabbix相关服务并开机自启

[root@localhost ~]# systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm
[root@localhost ~]# systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-server.service to /usr/lib/systemd/system/zabbix-server.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-agent.service to /usr/lib/systemd/system/zabbix-agent.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/rh-php72-php-fpm.service to /usr/lib/systemd/system/rh-php72-php-fpm.service.
[root@localhost ~]# 

浏览器访问http://ip/zabbix

全部显示OK才能下一步

输入设置的密码,下一步

成功安装前端

默认账号:Admin ,密码:zabbix

登录成功

0
  1. 支付宝打赏

    qrcode alipay
  2. 微信打赏

    qrcode weixin
  3. QQ打赏

    qrcode qq

评论区