zabbix -rockylinux安装


一、环境配置

1.1、修改主机名

[root@ecs-204824 /]# vi /etc/hostname
[root@ecs-204824 /]# cat /etc/hostname
zabbix
[root@ecs-204824 /]# reboot

1.2、修改静态ip地址

# 进入到网络接口配置文件
[root@zabbix ~]# vi /etc/NetworkManager/system-connections/ens33.nmconnection
# 修改以下内容
[connection]
id=ens33
uuid=9142aa95-a27d-34fc-96f0-b8c9d1611288
type=ethernet
autoconnect-priority=-999
interface-name=ens33
timestamp=1726545704

[ethernet]

[ipv4]
method=manual					# 这里修改为manual
addresses=192.168.1.100			# 本机IP地址
netmask=255.255.255.0			# 子网掩码
gateway=192.168.1.1				# 网关地址

[ipv6]
addr-gen-mode=eui64
method=auto

[proxy]
# 重新加载ens33.nmconnection文件
[root@zabbix ~]# systemctl reload NetworkManager
# 重启网络接口
[root@zabbix ~]# systemctl restart NetworkManager
# 重启系统
[root@zabbix ~]# reboot

1.3、系统更新

[root@zabbix ~]# dnf update -y
Rocky Linux 9 - Extras                           44 kB/s | 2.9 kB     00:00
Dependencies resolved.
================================================================================
 Package                   Arch   Version                       Repo       Size
================================================================================

1.4、安装epel仓库

[root@zabbix ~]# dnf install epel-release -y
Last metadata expiration check: 0:22:44 ago on Tue 08 Oct 2024 08:48:47 AM CST.
Package epel-release-9-8.el9.noarch is already installed.
Dependencies resolved.
Nothing to do.
Complete!

二、安装zabbix

2.1、添加zabbix仓库

[root@zabbix ~]# rpm -Uvh https://repo.zabbix.com/zabbix/6.0/rhel/9/x86_64/zabbix-release-6.0-4.el9.noarch.rpm
Retrieving https://repo.zabbix.com/zabbix/6.0/rhel/9/x86_64/zabbix-release-6.0-4.el9.noarch.rpm
warning: /var/tmp/rpm-tmp.6UZdaU: Header V4 RSA/SHA512 Signature, key ID 08efa7dd: NOKEY
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...
   1:zabbix-release-6.0-4.el9         ################################# [100%]
[root@zabbix ~]# dnf clean all
39 files removed
# 这条命令是跳过一些无法安装的依赖进行下一步安装
[root@zabbix ~]# sudo dnf install zabbix-server-mysql zabbix-web-mysql zabbix-apache-conf zabbix-sql-scripts zabbix-agent -y --allowerasing --skip-broken
Last metadata expiration check: 0:03:48 ago on Tue 08 Oct 2024 09:15:10 AM CST.
Dependencies resolved.

 Problem: package zabbix-web-deps-6.0.34-release2.el9.noarch from zabbix requires zabbix-web = 6.0.34-release2.el9, but none of the providers can be installed
  - cannot install both zabbix-web-6.0.34-release2.el9.noarch from zabbix and zabbix-web-1:6.0.33-2.el9.noarch from epel
  - package zabbix-apache-conf-6.0.34-release2.el9.noarch from zabbix requires zabbix-web-deps = 6.0.34-release2.el9, but none of the providers can be installed
  - package zabbix-web-mysql-1:6.0.33-2.el9.noarch from epel requires zabbix-web = 1:6.0.33-2.el9, but none of the providers can be installed
  - cannot install the best candidate for the job
[root@zabbix ~]# dnf install zabbix-web-deps -y --allowerasing
Last metadata expiration check: 0:16:28 ago on Tue 08 Oct 2024 09:15:10 AM CST.
Dependencies resolved.

2.2、配置数据库

[root@zabbix ~]# dnf install mariadb-server -y
Last metadata expiration check: 0:18:31 ago on Tue 08 Oct 2024 09:15:10 AM CST.
Dependencies resolved.
[root@zabbix ~]# systemctl enable --now mariadb
Created symlink /etc/systemd/system/mysql.service → /usr/lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/mysqld.service → /usr/lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/multi-user.target.wants/mariadb.service → /usr/lib/systemd/system/mariadb.service.
[root@zabbix ~]# 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
haven't set the root password yet, you should just press enter here.

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

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

You already have your root account protected, so you can safely answer 'n'.

Switch to unix_socket authentication [Y/n] y
Enabled successfully!
Reloading privilege tables..
 ... Success!


You already have your root account protected, so you can safely answer 'n'.

Change the 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] y
 ... Success!

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!
[root@zabbix ~]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 13
Server version: 10.5.22-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> 
MariaDB [(none)]> create database zabbix character set utf8mb4 collate utf8mb4_bin;
Query OK, 1 row affected (0.000 sec)

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

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

MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.000 sec)
[root@zabbix ~]# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix

2.3、配置zabbix服务器

[root@zabbix /]# vi etc/zabbix_server.conf
[root@zabbix /]# cat etc/zabbix_server.conf
# This is a configuration file for Zabbix server daemon
# To get more information about Zabbix, visit http://www.zabbix.com

############ GENERAL PARAMETERS #################

### Option: ListenPort
#       Listen port for trapper.
#
# Mandatory: no
# Range: 1024-32767
# Default:
# ListenPort=10051

### Option: SourceIP
#       Source IP address for outgoing connections.
#
# Mandatory: no
# Default:
# SourceIP=

### Option: LogType
#       Specifies where log messages are written to:
#               system  - syslog
#               file    - file specified with LogFile parameter
#               console - standard output
#
# Mandatory: no
# Default:
# LogType=file

### Option: LogFile
#       Log file name for LogType 'file' parameter.
#
# Mandatory: yes, if LogType is set to file, otherwise no
# Default:
# LogFile=

LogFile=/var/log/zabbixsrv/zabbix_server.log

### Option: LogFileSize
#       Maximum size of log file in MB.
#       0 - disable automatic log rotation.
#
# Mandatory: no
# Range: 0-1024
# Default:
# LogFileSize=1
LogFileSize=0

### Option: DebugLevel
#       Specifies debug level:
#       0 - basic information about starting and stopping of Zabbix processes
#       1 - critical information
#       2 - error information
#       3 - warnings
#       4 - for debugging (produces lots of information)
#       5 - extended debugging (produces even more information)
#
# Mandatory: no
# Range: 0-5
# Default:
# DebugLevel=3

### Option: PidFile
#       Name of PID file.
#
# Mandatory: no
# Default:
# PidFile=/tmp/zabbix_server.pid
PidFile=/run/zabbixsrv/zabbix_server.pid

### Option: SocketDir
#       IPC socket directory.
#               Directory to store IPC sockets used by internal Zabbix services.
#
# Mandatory: no
# Default:
# SocketDir=/tmp

### Option: DBHost
#       Database host name.
#       If set to localhost, socket is used for MySQL.
#       If set to empty string, socket is used for PostgreSQL.
#       If set to empty string, the Net Service Name connection method is used to connect to Oracle database; also see
#       the TNS_ADMIN environment variable to specify the directory where the tnsnames.ora file is located.
#
# Mandatory: no
# Default:
# DBHost=localhost

### Option: DBName
#       Database name.
#       If the Net Service Name connection method is used to connect to Oracle database, specify the service name from
#       the tnsnames.ora file or set to empty string; also see the TWO_TASK environment variable if DBName is set to
#       empty string.
#
# Mandatory: yes
# Default:
# DBName=

DBName=zabbix

### Option: DBSchema
#       Schema name. Used for PostgreSQL.
#
# Mandatory: no
# Default:
# DBSchema=

### Option: DBUser
#       Database user.
#
# Mandatory: no
# Default:
# DBUser=

DBUser=zabbix

### Option: DBPassword
#       Database password.
#       Comment this line if no password is used.
#
# Mandatory: no
# Default:
# DBPassword=
DBPassword=yuan3128..

2.4、启动zabbix服务

[root@zabbix /]# systemctl restart zabbix-server zabbix-agent httpd php-fpm
[root@zabbix /]# systemctl enable zabbix-server zabbix-agent httpd php-fpm
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

十一的学习笔记

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值