Centos8安装zabbix6.0(centos8安装zabbix5)

网友投稿 500 2022-09-09


Centos8安装zabbix6.0(centos8安装zabbix5)

关闭selinux

sed -i "s/SELINUX\=enforcing/SELINUX\=disabled/g" /etc/selinux/config

firewalld防火墙策略

firewall-cmd --zone=public --add-port=80/tcp --permanentfirewall-cmd --zone=public --add-port=10050/tcp --permanentfirewall-cmd --zone=public --add-port=10051/tcp --permanentsystemctl restart firewalld

卸载mariadb

[root@localhost ~]# rpm -qa | grep mariadb

mariadb-libs-5.5.68-1.el7.x86_64

[root@localhost ~]# yum remove mariadb-libs -y

配置yum

sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*sed -i 's|#baseurl=/etc/yum.repos.d/Cent*sed -i 's|$releasever|8-stream|g' /etc/yum.repos.d/Cent*

安装mysql

[root@localhost ~]# yum -y install wget[root@localhost ~]# yum -y install dnf[root@localhost ~]# dnf install @mysql 回车输入y,自动下载安装

启动mysql

mysqld --initialize-insecure --user=mysql

systemctl start mysqld

修改mysql密码:

先查看系统自动生成的密码【有的版本不需要这一步】[root@localhost mysql]# more /var/log/mysqld.log | grep password2022-05-04T13:06:01.810960Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: jMcXextbs9

修改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 configurationof 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) : yNew 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) : yBy default, a MySQL installation has an anonymous user,allowing anyone to log into MySQL without having to havea user account created for them. This is intended only fortesting, and to make the installation go a bit smoother.You should remove them before moving into a productionenvironment.Remove anonymous users? (Press y|Y for Yes, any other key for No) : ySuccess.Normally, root should only be allowed to connect from'localhost'. This ensures that someone cannot guess atthe root password from the network.Disallow root login remotely? (Press y|Y for Yes, any other key for No) : ySuccess.By default, MySQL comes with a database named 'test' thatanyone can access. This is also intended only for testing,and should be removed before moving into a productionenvironment.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 changesmade so far will take effect immediately.Reload privilege tables now? (Press y|Y for Yes, any other key for No) : ySuccess.All done!

安装依赖包

yum -y install php php-mysql php-common php-mbstring php-gd php-odbc php-pear curl curl-devel net-snmpnet-snmp-devel perl-DBI php-xml ntpdate php-bcmath gcc* libxml2 libxml2-devel net-snmp net-snmp-devel libssh2 libssh2-devel libevent libevent-devel

安装zabbix server

a. Install Zabbix repository

yum -y install dnfrpm -Uvh clean all

b. 安装Zabbix server,Web前端,agent

dnf install zabbix-server-mysql zabbix-web-mysql zabbix-apache-conf zabbix-sql-scripts zabbix-selinux-policy zabbix-agent

c. 创建初始数据库

在数据库主机上运行以下代码。

[root@localhost ~]# mysql -u root -pEnter password: Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 21Server version: 8.0.29 MySQL Community Server - GPLCopyright (c) 2000, 2022, Oracle and/or its affiliates.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> create database zabbix character set utf8mb4 collate utf8mb4_bin;Query OK, 1 row affected (0.00 sec)mysql> create user zabbix@localhost identified by '设置zabbix用户的密码';Query OK, 0 rows affected (0.02 sec)mysql> grant all privileges on zabbix.* to zabbix@localhost;Query OK, 0 rows affected (0.00 sec)mysql> quit;Bye

导入初始架构和数据,系统将提示您输入新创建的密码。

zcat /usr/share/doc/zabbix-sql-scripts/mysql/server.sql.gz | mysql -uzabbix -p zabbix

d. 为Zabbix server配置数据库

编辑配置文件 /etc/zabbix/zabbix_server.conf

DBPassword=password #增加这一行,密码是刚才创建的密码

e. 启动Zabbix server和agent进程

启动Zabbix server和agent进程,并为它们设置开机自启:

启动:systemctl restart zabbix-server zabbix-agent php-fpm设置开机启动:systemctl enable zabbix-server zabbix-agent php-fpm

f. 配置Zabbix前端

安装中文字体:

dnf install -y langpacks-zh_CN

连接到新安装的Zabbix前端: frontend​​

配置zabbix web

用户名:Admin

密码:zabbix

zabbix修改Admin密码

模板导出

模板修改前备份

模板修改【linux by zabbix agent】

只保留CPU、内存使用率,网络接口流量

先删除自动发现规则

删除图形里边

删除监控项

删除其他不相关的只剩,如下几项

关联-添加ICMP监控【也可以添加主机的时候单独关联】

通过备份模板恢复模板

添加监控主机


版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:使用MSTP+VRRP+默认路由+静态路由+子网划分+dhcp实验案例 实验环境(vrrp静态路由的配置实例)
下一篇:Java学习笔记:关于Java double类型相加问题
相关文章

 发表评论

暂时没有评论,来抢沙发吧~