Linux, Windows, Virtualization, OpenSource & Blogging

How To Install Zabbix Server 3.2 on CentOS 7 / Ubuntu 16.04 / Debian 8


Zabbix is an enterprise-class monitoring solution for servers, network devices, and other components of your infrastructure. Zabbix uses client (Zabbix Agent) installed on the monitored client-server to collect the data. Also, it can monitor standard services such as e-mail, web service without installing a client on the monitored devices.

With Zabbix, you can monitor almost everything that is on your infrastructure. Since Zabbix is enterprise ready, you can use Zabbix monitoring for environments ranging from small to larger.

Zabbix can act pro-actively for some of the issues and can fix the problem by restarting service or powering up a spare server through IPMI. With Zabbix, you will be able to analyze and decide server capacity planning easily.

Zabbix is free, released under the GPL license, so it is free commercial and non-commercial use.

Article Series:

PART 1: How To Install Zabbix Server 3.2 on CentOS 7 / Ubuntu 16.04 / Debian 8

PART 2: How to Install Zabbix Agent on CentOS 7 / Ubuntu 16.04 / Debian 8

PART 3: How to Add a Node to Zabbix Server for Monitoring

Features of Zabbix:

  • Monitor the metrics like CPU, memory, disk space, network and process of servers (Requires Zabbix Agent)
  • Monitoring of VMware vCeneter, VMware hypervisor, and virtual machines.
  • Automatically discovers VMware hypervisor and virtual machines using low-level discovery.
  • Monitoring of MySQL, PostgreSQL, Oracle and Microsoft SQL Server.
  • Zabbix has built-in Java application server monitoring.
  • Monitoring the network device with SNMP.
  • Web services monitoring.
  • Hardware monitoring such as temperature, fan speed, and disk state.

More features.

In this guide, we will talk about installing Zabbix Server and Client on CentOS 7 / RHEL 7, Ubuntu 16.04, and Debian 8.

System Requirements:


Zabbix requires atleast 128MB memory and 256MB of disk space to start with, however, the amount of memory depends on the number of hosts and parameters are being monitored.

2GB RAM and 2GB of disk space would be sufficient to monitor 500 hosts.


Apache: 1.3.12 or later
MySQL: 5.0.3 or later
PHP: 5.4.0 or later

Setup LAMP Environment:

Before installing Zabbix server, you need to setup LAMP server to meet the system requirements for Zabbix.

READ: How to setup LAMP on CentOS 7 / RHEL 7
READ: How to setup LAMP on Ubuntu 16.04 / Debian 8

If you have already configured LAMP on your server, you can skip the above steps.

Install PHP and PHP Extensions:

Install the required PHP extension using the following command.

### CentOS 7 ###

yum -y install php-cli php-common php-devel php-pear php-gd php-mbstring php-mysql php-xml

### Ubuntu 16.04 ###

apt-get install -y php-pear php-gd php-mbstring php-xml php-bcmath

### Debian 8 ###

apt-get -y install php5 php5-mysql php5-gd php5-cli php5-xmlrpc


Configure the firewall to allow Zabbix agent to reach Zabbix server.


firewall-cmd --permanent --add-port=10050/tcp
firewall-cmd --permanent --add-port=10051/tcp
firewall-cmd --permanent --add-port=80/tcp
firewall-cmd --reload
systemctl restart firewalld


ufw status
ufw allow 10050/tcp
ufw allow 10051/tcp
ufw allow 80/tcp
ufw reload
ufw enable

Configure Zabbix repository:

Zabbix is not available in our base OS by default, so install Zabbix repository configuration package.

### CentOS 7 ###

rpm -ivh

### Ubuntu 16.04 ###

sudo dpkg -i zabbix-release_3.2-1+xenial_all.deb
sudo apt-get update

### Debian 8 ###

sudo dpkg -i zabbix-release_3.2-1+jessie_all.deb
sudo apt-get update

Install Zabbix Server with MySQL:

Use the following command to install Zabbix server along with MySQL database support package on your system.

### CentOS 7 ###

yum install -y zabbix-server-mysql zabbix-web-mysql mariadb-server

### Ubuntu 16.04 / Debian 8 ###

apt-get install -y zabbix-server-mysql zabbix-frontend-php mariadb-server


To begin using the Apache with Zabbix server. Zabbix configuration file needs to be updated with TimeZone.

### CentOS 7 ###

vi /etc/httpd/conf.d/zabbix.conf

### Ubuntu 16.04 / Debian 8 ###

vi /etc/zabbix/apache.conf

Update the below line with correct timezone, more time zones.

php_value date.timezone Asia/Kolkata

Also, in addition to the above. It is recommended to set the following parameters.

php_value max_execution_time 600
php_value memory_limit 128M
php_value post_max_size 32M
php_value upload_max_filesize 16M
php_value max_input_time 600
php_value always_populate_raw_post_data -1

Restart the apache service.

### CentOS 7 ###

service httpd restart

### Ubuntu 16.04 / Debian 8 ###

service apache2 restart

SELinux (CentOS 7):

If you have SELinux enabled on your server, you need to run the following command to enable successful connection of Zabbix web frontend to the server.

setsebool -P httpd_can_connect_zabbix on

If you get an error like below,

Job for zabbix-server.service failed because a configured resource limit was exceeded. See "systemctl status zabbix-server.service" and "journalctl -xe" for details.

You may need to create custom exceptions and allow those through SELinux.

yum install policycoreutils-python
cat /var/log/audit/audit.log | grep zab | audit2allow -M zabbix-server
semodule -i zabbix-server.pp

Credit: Treg’s Blog

Create Zabbix database:

Start the database service.

### CentOS 7 ###

service mariadb restart

### Ubuntu 16.04 / Debian 8  ###

service mysql restart

Login to MariaDB and create the database and user for our Zabbix installation.

If you are starting/setting up MariaDB server for the first time then consider taking a look at Securing MariaDB, this is to ensure the MariaDB instance has root password set, no anonymous users, disallow root login remotely, and removing test database.

### CentOS 7 / Ubuntu 16.04 / Debian 8 ###

mysql -u root -p

Create a database with the following details.


Zabbix DBName=zabbixdb
Zabbix DBUser=zabbixuser
Zabbix DBPassword=zabbixpasswordd

mysql> create database zabbixdb character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbixdb.* to zabbixuser@localhost identified by 'zabbixpassword';
mysql> quit;

Once you are done creating the database for Zabbix installation, then import initial schema and data to the newly created database.

cd /usr/share/doc/zabbix-server-mysql*/
zcat create.sql.gz | mysql -u zabbixuser -p zabbixdb

Update Database Configuration:

Edit the zabbix_server.conf file to set the database details.

vi /etc/zabbix/zabbix_server.conf

Make sure you set as follows.



Restart all the services.

### CentOS 7 ###
service zabbix-server restart
service httpd restart
service mariadb restart

### Ubuntu 16.04 / Debian 8 ###

service zabbix-server restart
service apache2 restart
service mysql restart

Enable the service to start automatically on system reboot.

### CentoS 7 ###

systemctl enable zabbix-server
systemctl enable httpd
systemctl enable mariadb

### Ubuntu 16.04 / Debian 8 ###

update-rc.d zabbix-server enable
update-rc.d apache2 enable
update-rc.d mysql enable


You might also like
  • B Hopkins

    This worked out great for me. It took weeks of trying different commands before I found this list.
    None of the commands for other Zabbix packages or install methods would work on Amazon’s AWS EC2 Redhat RHEL 7.3. It seems there was always something missing.
    It seems the EC2 instance is not fully setup or needs some updating before beginning. Aslo, after getting going, something with the SQL scripts or some command was a bit off somewhere.

    One issue I did have was some PHP prerequisites were not installed by default on the EC2 RHEL 7.3 instance.
    After running: yum install -y zabbix-server-mysql zabbix-web-mysql mariadb-server
    I received the errors:

    Error: Package: zabbix-web-3.2.6-1.el7.noarch (zabbix)
    Requires: php-bcmath
    Error: Package: zabbix-web-3.2.6-1.el7.noarch (zabbix)
    Requires: php-mbstring

    I worked through it like this:

    yum update
    yum repolist all
    Look at the line: rhui-REGION-rhel-server-optional/7Server/x86_64 – it will say disabled
    run the command:
    sudo yum-config-manager –enable rhui-REGION-rhel-server-optional
    yum repolist all
    Look at this line again: rhui-REGION-rhel-server-optional/7Server/x86_64 it will now be enabled

    yum install php-bcmath.x86_64
    yum install php-mbstring.x86_64

    Then do:

    yum install -y zabbix-server-mysql zabbix-web-mysql mariadb-server

    That help was taken from:

How To Install Zabbix Server 3.2 on CentOS 7 / Ubuntu 16.04 / Debian 8