SoFunction
Updated on 2025-03-02

Configuration method for installing and deploying ZABBIX5.0 in CENTOS7 system

1. Introduction

zabbix is ​​an enterprise-level open source solution based on the [WEB] interface that provides distributed [system monitoring] and network monitoring functions. zabbix can monitor various network parameters to ensure the secure operation of [server system]; and provide a flexible notification mechanism to enable [system administrator] to quickly locate/solve various existing problems.

2. Installation and configuration

1. Turn off firewall and selinux

systemctl stop firewalld
systemctl disable firewalld
setenforce 0 # Set to temporarily close selinuxsed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config #Set permanently close selinuxreboot #Restart

2. Install the zabbix rpm source. In view of the domestic network situation, use the Alibaba Cloud zabbix source

rm -rf /etc//*
curl -o /etc// /repo/
yum clean all && yum repolist 
rpm -Uvh /zabbix/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.
sed -i 's##/zabbix#' /etc//

3. Install zabbix server and agent

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

4. Install Software Collections to facilitate subsequent installation of higher versions of php.

yum install centos-release-scl -y

5. Enable the zabbix front-end source, modify vi /etc//, and change enabled under [zabbix-frontend] to 1

enabled=1

6. Install the zabbix front-end and related environments

yum install zabbix-web-mysql-scl zabbix-apache-conf-scl -y
InstallzabbixAn error occurred on the front desk page,Cause of the problem:CentOS7ofSCLSource is2024Year6moon30The maintenance has stopped。 whensclUsed by default in the sourcecentos官方of地址,Unable to connect,Need to be replaced with Alibaba Cloud。
For specific operations, please refer to the following solutions:/weixin_71602103/article/details/140963932

7. Install mariadb database and set up the boot self-start

yum install mariadb-server -y     
systemctl enable --now mariadb

8. Initialize mariadb and configure the root password using the following command

mysql_secure_installation

9. Use root user to enter mysql and create a zabbix database, pay attention to database encoding

mysql -u root -p (Enter the databaserootPassword enters the database)
create database zabbix character set utf8 collate utf8_bin; #Create a databasecreate user zabbix@localhost identified by 'password'; #Create a usergrant all privileges on zabbix.* to zabbix@localhost; #Authorization(grant all privileges on * .* to zabbix@'%' identified by 'password' #Grant any host permission to access data)FLUSH PRIVILEGES #Modification takes effectquit;

10. Import the zabbix database. The user of the zabbix database is zabbix and the password is zabbix.

cd /usr/share/doc/zabbix-server-mysql*
gzip -d   

Import through any of the following methods:

cat /usr/share/doc/zabbix-server-mysql*/ | mysql -uzabbix -p zabbix
or mysql -u zabbix -p zabbix <  

11. Modify the database password in the zabbix server configuration file zabbix_server.conf

vi /etc/zabbix/zabbix_server.conf

Find DBPassword=password, change the database password to the password of the zabbix database, save and exit.

12. Modify the php configuration file of zabbix, the time zone in vi /etc/opt/rh/rh-php72//, and change it to Asia/Shanghai

php_value[] = Asia/Shanghai

13. Start the relevant services and configure automatic startup

systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm
systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm

3. Web initialization

1. Access using a browserhttp://ip/zabbixYou can access zabbix's web page

2. Click "Next step" to check whether the component is OK

3. ConfigurationConnect to the database, enter the password of the zabbix account, click "Next step",

4. Click "Next step"

5. Click "Next step"

6. When you see the summary message, it means that the installation is successful, click "Finish"

7. Enter the login interface IP/zabbix; Username: Admin, Password: zabbix;

8. Enter the main interface;

9. Set the language Chinese and the user is in the configuration.

Problems encountered during installation

1. Zabbix imports MySQL database error

​ zcat /usr/share/doc/zabbix-server-mysql*/ | mysql -uzabbix -p zabbix

Error message:

​ ERROR 1046 (3D000) at line 1: No database selected

​ Solution:

Edit the database file to be imported

​ vim /usr/share/doc/zabbix-server-mysql-5.0.15/

Add use zabbix to the first line, save and exit, and then reimport.

If an error occurs during the source installation, you can refer to the following operations if you cannot resolve the yum source or unknown errors.

Replace the Alibaba Cloud YUM source and then cache it;

https:///article/

This is the article about the installation and deployment of ZABBIX5.0 of CENTOS7 system. For more related content on the installation and deployment of ZABBIX5.0 of centos7, please search for my previous articles or continue browsing the related articles below. I hope everyone will support me in the future!