官方网站 https://www.zabbix.com/download?zabbix=6.2&os_distribution=centos&os_version=8_stream&db=mysql&ws=apache
1.关闭selinux
sed -i "s/SELINUX/=enforcing/SELINUX/=disabled/g" /etc/selinux/config
2.永久关闭防火墙
systemctl disable firewalld chkconfig iptables off
3.配置yum
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://mirrors.163.com|g' /etc/yum.repos.d/Cent* sed -i 's|$releasever|8-stream|g' /etc/yum.repos.d/Cent*
4.安装MYsql
[root@localhost ~]# yum -y install wget [root@localhost ~]# yum -y install dnf [root@localhost ~]# dnf install @mysql 回车输入y,自动下载安装
5.启动mysql
mysqld --initialize-insecure --user=mysql systemctl start mysqld
6.修改mysql密码
mysql_secure_installation
[root@localhost mysql]# mysql_secure_installation Securing the MySQL server deployment. Enter password for user root: 【默认直接回车,没有密码;或者是通过mysqld.log查看密码】 The 'validate_password' component is installed on the server. The subsequent steps will run with the existing configuration of the component. Using existing password for root. Estimated strength of the password: 100 Change the password for root ? ((Press y|Y for Yes, any other key for No) : y New password: Re-enter new password: Estimated strength of the password: 100 Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL 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? (Press y|Y for Yes, any other key for No) : 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? (Press y|Y for Yes, any other key for No) : y Success. By default, MySQL 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? (Press y|Y for Yes, any other key for No) : 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? (Press y|Y for Yes, any other key for No) : y Success. All done!
7.Install Zabbix repository
rpm -Uvh https://repo.zabbix.com/zabbix/6.2/rhel/8/x86_64/zabbix-release-6.2-1.el8.noarch.rpm dnf clean all
8.Switch DNF module version for PHP
dnf module switch-to php:7.4
9. Install Zabbix server, frontend, agent
dnf install zabbix-server-mysql zabbix-web-mysql zabbix-apache-conf zabbix-sql-scripts zabbix-selinux-policy zabbix-agent
10.Create initial database
mysql -u root -p password mysql> create database zabbix character set utf8mb4 collate utf8mb4_bin; mysql> create user zabbix@localhost identified by 'password'; mysql> grant all privileges on zabbix.* to zabbix@localhost; mysql> SET GLOBAL log_bin_trust_function_creators = 1; mysql> quit;
11.On Zabbix server host import initial schema and data. You will be prompted to enter your newly created password.
zcat /usr/share/doc/zabbix-sql-scripts/mysql/server.sql.gz | mysql -uzabbix -p zabbix
12.Disable log_bin_trust_function_creators option after importing database schema.
mysql -u root -p password mysql> SET GLOBAL log_bin_trust_function_creators = 0; mysql> quit;
13.Configure the database for Zabbix server
Edit file /etc/zabbix/zabbix_server.conf
DBPassword=password 配置连接数据库密码
14.Start Zabbix server and agent processes
Start Zabbix server and agent processes and make it start at system boot.
systemctl restart zabbix-server zabbix-agent httpd php-fpm systemctl enable zabbix-server zabbix-agent httpd php-fpm
15.安装中文字体:
dnf install -y langpacks-zh_CN
16.配置web地址与端口号
/etc/httpd/conf/httpd.conf
17.配置zabbix web
连接到新安装的Zabbix前端: http://server_ip_or_name/zabbix
根据Zabbix文件里步骤操作: Installing frontend
用户名:Admin
密码:zabbix
zabbix修改Admin密码
模板导出
模板修改前备份
只保留CPU、内存使用率,网络接口流量
先删除自动发现规则
删除图形里边
删除监控项
删除其他不相关的只剩,如下几项
关联-添加ICMP监控【也可以添加主机的时候单独关联】
通过备份模板恢复模板
添加监控主机
https://blog.51cto.com/506554897/5274786
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/279158.html