赞
踩
Zabbix 是一款企业级的开源监控解决方案,主要用于分布式系统和网络设备的监控。它提供了基于Web界面的集中管理和监控功能,能够实时监控服务器的各项性能指标,如CPU负载、内存使用情况、磁盘空间占用,以及网络流量等,并且支持自动发现网络中的服务器与设备。
- #systemctl stop firewalld
- #systemctl disable firewalld
- #SELINUX=disabled
- 这是临时关闭,重启后恢复,我没有永久关闭,Zabbix正常使用
根据自己的OS和需求选择对应的版本和组件
我是使用Ubuntu22.04安装的,这里你可以根据自己的需求选择就行了
选择好后在该网页的下方会有官方的安装步骤,如下图所示
- # wget https://repo.zabbix.com/zabbix/6.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.4-1+ubuntu22.04_all.deb
- # dpkg -i zabbix-release_6.4-1+ubuntu22.04_all.deb
- # apt update
# apt install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-sql-scripts zabbix-agent
官方教程的这两个步骤是没问题的,直接照着操作就行了
这里我是使用的mariadb数据库,下面是具体的安装步骤
-
- # apt install mariadb-server -y
- # systemctl start mariadb
- # systemctl enable mariadb
- # mysql_secure_installation
-
- NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
- SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
-
- Enter current password for root (enter for none): # 当前root还没有密码,直接回车即可
-
- Set root password? [Y/n] y # 是否要设置root密码,y
- New password: # 123(可自定义)
- 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 # 当前有个anonymous用户,是否移除 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 # 不允许root远程登录, 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 # 是否移除test数据库 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 # 是否重载权限表 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数据库的密码
- mysql> create database zabbix character set utf8mb4 collate utf8mb4_bin;
- mysql> create user zabbix@localhost identified by '123'; #这里密码123可自定义,下一步需要用到
- mysql> grant all privileges on zabbix.* to zabbix@localhost;
- mysql> set global log_bin_trust_function_creators = 1;
- mysql> quit;
导入初始架构和数据,系统将提示您输入新创建的密码 ,这里输入上一步自定义的user zabbix@localhost的密码
# zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix
导入数据库模式后禁用 log_bin_trust_function_creators 选项,这里跟着官方教程来就行
- # mysql -uroot -p
- 这里是mariadb数据库密码
- mysql> set global log_bin_trust_function_creators = 0;
- mysql> quit;
编辑配置文件 /etc/zabbix/zabbix_server.conf
vi /etc/zabbix/zabbix_server.conf
修改
# DBPassword=password
这里要找到这一行,把前面的#号去掉,并修改后面的password为自己设置的数据库密码,具体vim命令可参考Ubuntu虚拟机vim操作命令
启动Zabbix server和agent进程,并为它们设置开机自启:
- # systemctl restart zabbix-server zabbix-agent apache2
- # systemctl enable zabbix-server zabbix-agent apache2
这里也是直接按照官方教程来就行
使用 Apache Web 服务器时 Zabbix UI 的默认 URL 是 http://host/zabbix,host为Ubuntu的ens33的ip地址,可以使用 ip a 命令查看ens33的ip地址信息。
这里可能出现apache2的80端口被占用的问题,可以使用nestat -tnlp |grep 80查看,如果是被占用了,可以使用kill 进程号的命令杀掉对应进程。
注:在配置DB连接时只需输入自己之前创建的mariadb数据库密码即可
至此,Ubuntu 22.04.4 Zabbix6.4部署安装完成。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。