You can support us by downloading this article as PDF from the Link below. Download the guide as PDF

Welcome to our guide on how to install Zabbix Server 5.0 on CentOS 7 Server. Our previous guide was on the installation of How to Install Zabbix Server on Ubuntu. Zabbix is a powerful open source monitoring solution used to monitor server applications, systems, Network devices, Hardware appliances, IoT devices, e.t.c. Its backend is written in C and Java while the user web interface written in PHP.

Zabbix Architecture (Server & Client)

Zabbix works in a Client/Server model. The server communicates to the native software agents available for various Operating systems like Linux, NIX, and Windows. For systems without an agent, generic monitoring protocols such as Simple Network Management Protocol (SNMP) or Intelligent Platform Management Interface (IPMI) can be used.

Install Zabbix Server 5.0 on CentOS 7

Zabbix Server depends on the following software applications:

  • Apache web server
  • PHP with required extensions
  • MySQL/ MariaDB database server

MySQL or MariaDB can be a remote server, but php and httpd need to be installed on the Zabbix server. It is possible to run Apache web server in reverse proxy mode.

It is recommended to have SELinux in permissive mode unless you know how to fix its issues:

sudo setenforce 0
sudo sed -i 's/^SELINUX=.*/SELINUX=permissive/g' /etc/selinux/config

Step 1: Install and Configure Apache httpd server

Install Apache web server on CentOS 7 server by running the command:

sudo yum -y install httpd vim

After installing Apache, configure basic security by allowing Prod ServerTokens only on./etc/httpd/conf/httpd.conf Add the following line at the end of the file:

$ sudo vim /etc/httpd/conf/httpd.conf
ServerSignature Off
ServerTokens Prod

The directive ServerTokens configures what is returned as the Server HTTP response. Valid options are Full | OS | Minimal | Minor | Major | Prod.

Set ServerName:

# sudo vim /etc/httpd/conf/httpd.conf
ServerName zabbix.example.com

Set Server Admin to receive an email in case of issues.

$ sudo vim /etc/httpd/conf/httpd.conf
ServerAdmin [email protected]

Restart apache web service after making the changes:

sudo systemctl restart httpd

If  you have a firewalld firewall installed and enabled, allow access to port 443 and 80:

sudo firewall-cmd --add-service={http,https} --permanent
sudo firewall-cmd --reload

Step 2: Install MariaDB Database server

Install MariaDB database server on CentOS 7 server using our guide:

How to Install MariaDB 10.x on CentOS 7

Once Database server is installed, you need to create a database for Zabbix user:

export zabbix_db_pass="StrongPassword"
mysql -uroot -p <<MYSQL_SCRIPT
    create database zabbix character set utf8 collate utf8_bin;
    grant all privileges on zabbix.* to [email protected]'localhost' identified by '${zabbix_db_pass}';
    FLUSH PRIVILEGES;
MYSQL_SCRIPT

Replace “StrongPassword” with your desired password for the database.

Step 3: Install Zabbix 5.0 Server on CentOS 7

Now that we have required dependencies installed and working, we can finalize our installation by deploying Zabbix 5.0 server.

Add Zabbix 5.0 repository:

sudo yum install -y https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm

Now install Zabbix 5.0 Server and frontend with MySQL support:

sudo yum install zabbix-server-mysql zabbix-agent zabbix-get

Substitute ‘mysql‘ in the commands with ‘pgsql‘ to use PostgreSQL, or with ‘sqlite3‘ to use SQLite3 (proxy only).

Install Zabbix Frontend:

sudo yum-config-manager --enable zabbix-frontend
sudo yum -y install centos-release-scl
sudo yum -y install zabbix-web-mysql-scl zabbix-apache-conf-scl

Import Zabbix Server database schema

For Zabbix server and Zabbix proxy daemons, a database is required. It is not needed to run Zabbix agent. If Zabbix server and proxy are installed on the same host, their databases must be created with different names!

Import initial schema and data for the server with MySQL:

sudo su -
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix

Enter your Zabbix database user password when prompted.

With PostgreSQL:

zcat /usr/share/doc/zabbix-server-pgsql*/create.sql.gz | sudo -u <username> psql zabbix

Step 4: Configure and start Zabbix server

Edit your Zabbix configuration file  /etc/zabbix/zabbix_server.conf and set database connection settings.

$ sudo vim /etc/zabbix/zabbix_server.conf
DBName=zabbix
DBUser=zabbix
DBPassword=StrongPassword

Configure PHP for Zabbix frontend – set timezone.

$ sudo vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
php_value[date.timezone] = Africa/Nairobi

Start Zabbix server and agent processes and enable them to start at system boot.

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

Configure Firewall

If you have ufw firewall installed and running on your system, ensure you allow port 5000 and port 5001:

sudo firewall-cmd --add-port={10051/tcp,10050/tcp} --permanent
sudo firewall-cmd --reload

Restart httpd and start frontend installation:

sudo systemctl restart httpd

Step 5: Perform Zabbix initial setup

Access “http://(Zabbix server’s hostname or IP address)/zabbix/”  to begin Zabbix initial setup.

Step 1 is a welcome page, click “Next step” to proceed.

Confirm that all pre-requisites are satisfied.

Configure DB settings

Confirm Hostname and Port number for Zabbix server. It is okay to use localhost in place of a name.

Verify all settings and click Next step to finish the initial setup. If all goes well, you should get congratulations page. Click the Finish button to end installation.

You’ll then get the login page. Default logins are:

Username: "Admin"
Password: "zabbix"

Dashboard for Zabbix server 5.0 looks like below

Step 6: Change Admin Password

Login to Zabbix admin dashboard with admin user and password zabbix. You need to change the password for admin user after the first login for security reasons.

Navigate to Administration > Users > Admin > Password > Change Password

Configure Monitoring Target host

Now that we have our Zabbix server ready for monitoring, you can start configuring first monitoring target host. By default, Zabbix server is added to monitoring.

To add other host devices, login to Zabbix admin dashboard with the username admin and click on Configuration > Hosts. 

After a few minutes, monitoring data will start flowing in, to check host graphs go to Monitoring > Screens > Server name.

More on monitoring:

Install Cacti on Debain

How To Install LibreNMS on CentOS / RHEL 8

How To Install Zabbix Server on CentOS / RHEL 8

You can support us by downloading this article as PDF from the Link below. Download the guide as PDF