Home » Guides » Ways To Install Zabbix on Linux: Ubuntu, Debian, CentOS, RHEL, Arch Linux, etc.

Ways To Install Zabbix on Linux: Ubuntu, Debian, CentOS, RHEL, Arch Linux, etc.

Network management is a core component of system administration. You’d require tools that allow you to monitor the network 24/7 for proper administering. And that is where Zabbix comes into play. It is a free and open-source monitoring tool that offers a ton of features to make the job much easier. You can also use it to monitor your cloud infrastructure with ease, as well as servers, applications, and even web-based services. This all-around tool also lets you monitor storage, databases, virtual computers, telephones, and other networks. 

Zabbix works in real-time and can help you collect different types of data that are then used to create historical graphics or load trends for monitoring. You can use it to check standard networking services without the need for any extra software. For this, you can always install and configure Zabbix as an agent. But more on that later. For now, the following guide will help you install Zabbix on Linux.

Table Of Contents

What is Zabbix?

Created by Alexei Vladishev, Zabbix is an enterprise-class open-source monitoring solution. As software, it monitors the numerous parameters of a network and its health and integrity. It also works for servers, virtual machines, applications, services, databases, websites, and so on. The tool also offers a flexible notification mechanism that involves email-based alerts. It makes reacting to server issues much faster. The tool offers excellent reporting and data visualization based on stored data, making it excellent for capacity planning.

Zabbix also supports polling and trapping, as well as configuration parameters, which are accessed through a web-based frontend. It ensures that your network status and server health can be assessed from elsewhere. It is written and distributed using the AGPL-3.0 license. Its source code is freely distributed and available to the public.

zabbix, install zabbix on linux
Zabbix

Features of Zabbix

Zabbix offers numerous features:

  • Data gathering
  • Performance checks
  • SNMP support
  • IPMI, JMX, and VMware monitoring
  • Custom and modified checks
  • Installation as agent
  • Flexible definitions
  • Configurable alerts
  • Remote commands
  • Real time graphing
  • Web monitoring capabilities
  • Extensive visualization options
  • High-level (business) view of monitored resources
  • Historical data storage
  • Data stored in a database
  • Easy configuration
  • Use of templates
  • Network discovery
  • Agent Auto-registration
  • Fast web interface
  • Accessible from anywhere
  • An audit log
  • Secure user authentication
  • Written in C, for performance and small memory footprint
  • Portable
  • Ready for complex environments

Install Zabbix On Linux:

There are two major methods to install Zabbix on Linux. Be it installing from distribution packages or compiling from source. Otherwise, you can also download it as a virtual appliance. Here is what you have to do:

Method 1. Install Zabbix On Linux From Source

Let us start by building Zabbix on Linux from the source. For this, we need to first download the source archive, which There are several ways of getting:

Step 1. Go to the Zabbix download page and download the source archive. Or you can visit the Git Repo. You can get the latest development version from the Git source code repository system:

Step 1.1 – For the development version, you must have a Git client installed to clone the repository. Run the following command:

sudo apt-get update
sudo apt-get install git

Step 1.2 – Now, grab all Zabbix source and change to the directory you want to place it:

git clone https://git.zabbix.com/scm/zbx/zabbix.git

Step 2. After that, extract the sources using TAR:

tar -zxvf zabbix-7.0.0.tar.gz

Step 3. Then, create a user account

Note: For Zabbix daemon processes, an unprivileged user is required. If a Zabbix daemon is started from an unprivileged user account, it will automatically run as that user. But you must ensure there is a Zabbix user account. For this:

On a Debian-based system

addgroup --system --quiet zabbix
       adduser --quiet --system --disabled-login --ingroup zabbix --home /var/lib/zabbix --no-create-home zabbix

On RHEL

groupadd --system zabbix
       useradd --system -g zabbix -d /usr/lib/zabbix -s /sbin/nologin -c "Zabbix Monitoring System" zabbix

Note: Zabbix server and agent should have different users if they are on the same machine. Running Zabbix as root, bin, or any other account with special rights is a security risk.

Step 4. Now, create a Zabbix database

For MySQL/MariaDB

mysql -uroot -p<password>
       mysql> create database zabbix character set utf8mb4 collate utf8mb4_bin;
       mysql> create user 'zabbix'@'localhost' identified by '<password>';
       mysql> grant all privileges on zabbix.* to 'zabbix'@'localhost';
       mysql> SET GLOBAL log_bin_trust_function_creators = 1;
       mysql> quit;

Step 4.1 – Import the data into the database and set the utf8mb4 character set as default. 

cd database/mysql
       mysql -uzabbix -p<password> zabbix < schema.sql
       # stop here if you are creating database for Zabbix proxy
       mysql -uzabbix -p<password> zabbix < images.sql
       mysql -uzabbix -p<password> --default-character-set=utf8mb4 zabbix < data.sql

Step 4.2 – After that, disable the log_bin_trust_function_creators

mysql -uroot -p<password>
       mysql> SET GLOBAL log_bin_trust_function_creators = 0;
       mysql> quit;

Step 5. Now, configure the sources

Note: C99 with GNU extensions is required for building a Zabbix server, Zabbix proxy, or Zabbix agent. This version can be explicitly specified by setting CFLAGS=”-std=gnu99“:

./bootstrap.sh
export CFLAGS="-std=gnu99"

Step 6. Finally, specify the database type to be used. Only one database type can be compiled with a server or proxy process at a time.

Step 6.1 – To see the supported configuration options, run the following command:

./configure --help

Step 6.2 – Then, to configure the sources for a Zabbix server and agent, you may run something like:

./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2 --with-openipmi

Step 7. Lastly, Make and install everything

make dbschema
make install

Method 2. Install Zabbix On Linux From Packages

For Alma Linux/CentOS/RHEL

Step 1. Start by installing the Zabbix repository

Step 1.1 – For this, you have to disable the Zabbix packages provided by EPEL, if you have it installed. 

Step 1.2 – Edit file /etc/yum.repos.d/epel.repo and add the following statement.

excludepkgs=zabbix*

Step 1.3 – Now, proceed with installing the Zabbix repository.

rpm -Uvh https://repo.zabbix.com/zabbix/7.0/alma/9/x86_64/zabbix-release-7.0-5.el9.noarch.rpm
dnf clean all

Step 2. Then, install the Zabbix server, frontend, and agent:

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

Step 3. After that, create the initial database

Note: Make sure you have the database server up and running.

mysql -uroot -p
password
mysql> create database zabbix character set utf8mb4 collate utf8mb4_bin;
mysql> create user zabbix@localhost identified by 'password';
mysql> grant all privileges on zabbix.* to zabbix@localhost;
mysql> set global log_bin_trust_function_creators = 1;
mysql> quit;

Step 4. Host import initial schema and data. You will be prompted to enter your newly created password.

zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix

Step 5. Finally, disable the log_bin_trust_function_creators option after importing the database schema.

mysql -uroot -p
password
mysql> set global log_bin_trust_function_creators = 0;
mysql> quit;

Step 6. Configure the database for the Zabbix server by editing file /etc/zabbix/zabbix_server.conf

DBPassword=password

Step 7. Lastly, start the Zabbix server and agent processes

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

For Debian

Step 1. Once again, start by installing the  Zabbix repository

wget https://repo.zabbix.com/zabbix/7.0/debian/pool/main/z/zabbix-release/zabbix-release_7.0-2+debian12_all.deb
dpkg -i zabbix-release_7.0-2+debian12_all.deb
apt update

Step 2. Then, install the Zabbix server, frontend, and agent:

apt install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-sql-scripts zabbix-agent

Step 3. Now, create the initial database

mysql -uroot -p
password
mysql> create database zabbix character set utf8mb4 collate utf8mb4_bin;
mysql> create user zabbix@localhost identified by 'password';
mysql> grant all privileges on zabbix.* to zabbix@localhost;
mysql> set global log_bin_trust_function_creators = 1;
mysql> quit;

Step 4. After that, import the initial schema and data and then enter your newly created password.

zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix

Step 5. Disable the log_bin_trust_function_creators option after importing the database schema.

mysql -uroot -p
password
mysql> set global log_bin_trust_function_creators = 0;
mysql> quit;

Step 6. Configure the database for the Zabbix server by editing the file /etc/zabbix/zabbix_server.conf

DBPassword=password

Step 7. Start Zabbix server and agent processes

systemctl restart zabbix-server zabbix-agent apache2
systemctl enable zabbix-server zabbix-agent apache2

For OpenSUSE

Step 1. First, install the Zabbix repository

rpm -Uvh --nosignature
https://repo.zabbix.com/zabbix/7.0/sles/15/x86_64/zabbix-release-7.0-3.sles15.noarch.rpm
zypper --gpg-auto-import-keys refresh 'Zabbix Official Repository'

Step 2. Then, install the Zabbix server, frontend, and agent:

zypper in zabbix-server-mysql zabbix-web-mysql zabbix-apache-conf-php8 zabbix-sql-scripts zabbix-agent

Step 3. After that, create an initial database

mysql -uroot -p
password
mysql> create database zabbix character set utf8mb4 collate utf8mb4_bin;
mysql> create user zabbix@localhost identified by 'password';
mysql> grant all privileges on zabbix.* to zabbix@localhost;
mysql> set global log_bin_trust_function_creators = 1;
mysql> quit;

Step 4. Import the initial schema and data.

zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix

Step 5. Now, disable the log_bin_trust_function_creators option after importing the database schema.

mysql -uroot -p
password
mysql> set global log_bin_trust_function_creators = 0;
mysql> quit;

Step 6. Configure the database for the Zabbix server.

Step 7. Start the Zabbix server and agent processes

systemctl restart zabbix-server zabbix-agent apache2
systemctl enable zabbix-server zabbix-agent apache2

On Ubuntu

Step 1. First, become a root user

Step 1.1 – Start a new shell session with root privileges.

sudo -s

Step 2. Then, install the Zabbix repository

wget https://repo.zabbix.com/zabbix/7.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_7.0-2+ubuntu24.04_all.deb
dpkg -i zabbix-release_7.0-2+ubuntu24.04_all.deb
apt update

Step 3. Now, install the Zabbix server, frontend, and agent

apt install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-sql-scripts zabbix-agent

Step 4. Now, create an initial database

mysql -uroot -p
password
mysql> create database zabbix character set utf8mb4 collate utf8mb4_bin;
mysql> create user zabbix@localhost identified by 'password';
mysql> grant all privileges on zabbix.* to zabbix@localhost;
mysql> set global log_bin_trust_function_creators = 1;
mysql> quit;

Step 5. Import initial schema and data. 

zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix

Step 6. Finally, disable the log_bin_trust_function_creators option.

mysql -uroot -p
password
mysql> set global log_bin_trust_function_creators = 0;
mysql> quit;

Step 7. Start the Zabbix server and agent processes

systemctl restart zabbix-server zabbix-agent apache2
systemctl enable zabbix-server zabbix-agent apache2
Gilbert John Avatar