The PalmTree Network

Your money. Your time. Your future.

Zabbix Server Installation

This section is part of the Zabbix & Elrond Guide

Be careful, we design this guide using a setup with the 3 main parts of the server in the same machine (Zabbix Server, Apache and Mysql). And these steps are to install the version 4.4 of Zabbix. The guide is for educational purposes so, enjoy every step but try to understand the process well, stay calm and go step by step.

There are plenty of installation guides, if you search on the internet, we’ll go directly for the official one, as it’s really fast process. If you need to tweak things you can always customize some of this steps.

INSTALL APACHE2

Usually in ubuntu 18.04 you have Apache, but best to be sure follow this steps:

sudo apt update

sudo apt install apache2

Then we make that the service run always when we boot

sudo systemctl start apache2

sudo systemctl enable apache2

Finally, we can check the status of the service:

sudo systemctl status apache2

INSTALL PHP PACKAGES

Now we’ll install php to be sure that we have at least version 5.4 running:

sudo apt install php-cli php-common php-dev php-pear php-gd php-mbstring php-mysql php-xml php-bcmath libapache2-mod-php

Once the installation is complete go to the PHP configuration file and edit it:

cd /etc/php/7.2/

Edit the php.ini configuration for both Apache2 and Cli

sudo nano apache2/php.ini

sudo nano cli/php.ini

And make sure you change the details of this section

date.timezone = Europe/Germany

max_execution_time = 600

max_input_time = 600

memory_limit = 256M

post_max_size = 25M

upload_max_filesize = 16M

Finally restart the apache with

sudo systemctl restart apache2

If you don’t see any error then you have PHP and Apache2 running well

INSTALL ZABBIX REPOSITORIES

sudo wget https://repo.zabbix.com/zabbix/4.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_4.4-1+bionic_all.deb
sudo dpkg -i zabbix-release_4.4-1+bionic_all.deb
sudo apt update

INSTALL PACKAGES

We’ll install in the same line, database, web-server and an agent that will run on server machine only to be able to check that everything is working.

sudo apt install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-agent zabbix-get mysql-server -y

CONFIGURE DATABASE

We go to the installation of MySQL Server. You can install MariaDB if you prefer.

Start MySQL with this command line:

sudo systemctl start mysql

By default there’s no root password in MySQL. We’ll keep this way, to make it simpler, search in internet if you want to change it.

Open MySQL terminal with the command:

sudo mysql -uroot
mysql-1.PNG

Now, inside the Mysql terminal we’ll create a new database where Zabbix Server will store all its data.

create database zabbix character set utf8 collate utf8_bin;

Be careful, always the commands that we execute inside the MySQL terminal must end on “;”

Now we just need to add a new user on MySQL that has permissions to use this database named ‘zabbix’

create user 'zabbix'@'localhost' identified by '';
grant all privileges on zabbix.* to 'zabbix'@'localhost';

Remember to change ‘’ for a unique password for this user. Remember to take note because later you will need to setup the user and password that will use Zabbix Server to connect to the database.

If you look now at your current databases with “show databases;” command, you will see a zabbix one. But it’s empty.

show databases;
quit;

We need to add all the tables, images, variables, everything that Zabbix Server needs from start on this database.

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

In this example we don’t need to add credentials like specific username and password to execute this import of data because remember that we are using an empty password root on MySQL.

CONFIGURATION FILES

We need to change only a couple of things, it will be easy. Edit this file:

sudo nano /etc/zabbix/zabbix_server.conf

Search for the section where you will find DBname=zabbix and DBuser=zabbix. Some lines below there’s DBPassword commented variable. Just write there something like:

DBPassword=

Remember to write the password that you use when you create the user zabbix on MySQL. Be careful, the configuration labels are case sensitive.

We now can start the zabbix server with a simple command:

sudo systemctl start zabbix-server

Finally we need to edit only one thing before we start with the Browser Installation Assistant. The region of ourselves.

sudo nano /etc/zabbix/apache.conf

You will see inside a parameter that is commented, php_value time.zone… you need to remove “#” to make it functional. And select your correct time.zone value.

At this point we only need to start our web engine apache

sudo systemctl start apache2

BROWSER GUI INSTALLATION

Go to your web browser and type http://theipofyourzabbixserver/zabbix

If you are connecting from a remote ip, be sure that the firewall on zabbix server is disbled or has at least ports 80, 443, 10050 and 10051 open.

You will see a welcome to Zabbix 4.4 configuration Wizard. Click on “Next step” button.

Then you will see a list of checks that everything is well installed, you must have all this as OK. Click again on “Next step”.

zabbix-db-setup.png

Here you must rewrite again the same password that we wrote on DBPassword, the one that we created as identified when we grant permissions on MySQL zabbix database. The we click “Next step” again.

It will ask us for a name for the website, this field will be used only as a Tab name on your browser. When you’re done, click “Next step” again.

You’ll see a preinstallation summary, just check quickly everything and click “Next step”. And then you get a “Congratulations message”. Finally you can click on “Finish” button.

The login screen will ask you for user and password. The default user is “Admin” and the default password “zabbix”.

And you are ready, your server is installed well now.

ACTIVATE HTTPS ON YOUR FRONTEND

It’s optional but we can make our server accesible by https secure protocol. Create directory to ssl certificate.

sudo mkdir -p /etc/httpd/ssl/private
sudo chmod 700 /etc/httpd/ssl/private

Create a new SSL certificate:

sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/httpd/ssl/private/apache-selfsigned.key -out /etc/httpd/ssl/apache-selfsigned.crt

You will be asked for some data, the most important is Common name, in your case you can write directly the IP of your zabbix server. If you use a DNS domain you can write it here instead:

Country Name (2 letter code) [XX]:
State or Province Name (full name) []:
Locality Name (eg, city) [Default City]:
Organization Name (eg, company) [Default Company Ltd]:
Organizational Unit Name (eg, section) []:
Common Name (eg, your name or your server's hostname) []:example.com
Email Address []:

Edit apache httpd config

sudo mkdir -p /etc/httpd/conf.d/
sudo nano /etc/httpd/conf.d/ssl.conf

Edit this lines, you can change the example.com by your server IP, be sure that this configuration variables are not commented with a #

DocumentRoot "/usr/share/zabbix"
ServerName example.com:443
SSLCertificateFile /etc/httpd/ssl/apache-selfsigned.crt
SSLCertificateKeyFile /etc/httpd/ssl/private/apache-selfsigned.key

Restart Apache Service to apply changes:

sudo systemctl restart apache2