Home > Backend Development > PHP Problem > How to install Zabbix4 and PHP on CentOS 7

How to install Zabbix4 and PHP on CentOS 7

PHPz
Release: 2023-04-12 11:24:37
Original
677 people have browsed it

Zabbix4 Install PHP

Zabbix is ​​an enterprise-level open source network monitoring system that can monitor many types of network devices, including servers, routers, switches, etc. Zabbix can run on Linux, Windows and Unix systems and provides a wide range of alarm and monitoring functions, allowing administrators and operation and maintenance personnel to monitor the entire network environment in real time and respond immediately.

However, when installing Zabbix, a very important prerequisite is that PHP must be installed first. PHP is a server-side scripting language. It is mainly used for website development and database programming. It is the basic environment for Zabbix to run. This article will introduce how to install Zabbix4 and PHP on CentOS 7.

Step 1: Install the necessary software packages

Before installing Zabbix, you need to install some necessary software packages for the system. These software packages include:

  • Apache
  • PHP
  • PHP-FPM
  • MariaDB
  • MariaDB-server

can be run on CentOS 7 with the following command Install these packages:

sudo yum -y install httpd php php-fpm mariadb mariadb-server
Copy after login

During installation, you will be prompted for your root password. Be sure to remember this password because you will need it to configure the MySQL database after installing Zabbix.

Step 2: Create Zabbix database

Before installing Zabbix, you need to create a Zabbix database first. It can be created with the following command:

sudo mysql -u root -p
Copy after login

After entering the root password you created when installing the package, the MySQL console will open. Execute the following command on the console:

CREATE DATABASE zabbix character set utf8 collate utf8_bin;
CREATE USER 'zabbix'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON zabbix.* TO 'zabbix'@'localhost';
FLUSH PRIVILEGES;
Copy after login

Please replace "password" in the above command with the password you set yourself. This password will be used to connect to the Zabbix database.

Step 3: Install Zabbix4

Now, we can start installing Zabbix4. The official yum repository of Zabbix4 is available on CentOS 7. The repository can be enabled with the following command:

sudo rpm -ivh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
Copy after login

Then, run the following command to install Zabbix:

sudo yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent
Copy after login

Before installing, make sure you have enabled the EPEL repository as Zabbix depends on it Packages in the repository. You can verify that the repository has been enabled with the following command:

yum repolist | grep epel
Copy after login

If EPEL does not appear, first enable EPEL with the following command:

sudo yum install epel-release
Copy after login

Step 4: Configure Zabbix4

After the installation is complete, Zabbix needs to be configured to ensure that it can connect to the MySQL database. First, open the Zabbix server configuration file /etc/zabbix/zabbix_server.conf and uncomment the following line and make the necessary changes:

DBName=zabbix
DBUser=zabbix
DBPassword=<password>
Copy after login

Please replace the "password" above with the one you used in the second step Password set.

Next, open the Zabbix website configuration file /etc/httpd/conf.d/zabbix.conf and make the following changes:

# php_value date.timezone UTC
php_value date.timezone Asia/Shanghai
Copy after login

The above changes will change the time zone to China standard time zone. If you are in a different time zone, change this option.

Step 5: Start Zabbix4

Finally, start the Zabbix service and Apache server:

sudo systemctl start zabbix-server
sudo systemctl enable zabbix-server
sudo systemctl start httpd
sudo systemctl enable httpd
Copy after login

Now Zabbix is ​​ready, you can enter the server IP address in the browser or hostname to access the Zabbix user interface.

Summary

Through its intuitive interface, comprehensive monitoring functions, flexible alarm mechanism and other features, Zabbix has become an important tool for network management and operation and maintenance teams. When installing Zabbix, you must first install PHP. The installation steps of zabbix4 on CentOS 7 system are as follows:

  • Install the necessary software packages
  • Create Zabbix database
  • Install Zabbix4
  • Configure Zabbix4
  • Start Zabbix4

If the configuration is accurate and the startup is normal, you can use the efficient and convenient Zabbix4.

The above is the detailed content of How to install Zabbix4 and PHP on CentOS 7. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template