System and server administrators need to have professional software installed, in order to be able to monitor what is happening on them or their networks, with the primary objective of preventing failures and if they exist, to be able to keep up to date in the shortest possible time.
As the article title says, Zabbix is a fantastic open-source application that monitors networks within a given topology. It was first created by Alexei Vladishev, specialized in networks with an important user base and an active community, that is always contributing both in its development and in its support for users. Uses MySQL, PostgreSQL, SQLite, Oracle or IBM DB2 as database. Its backend is written in C and the web frontend is written in PHP.
Let’s get to work: installing the Prerequisites
The first thing we must always do is to make sure that our system is up to date. For them we write on a terminal:
sudo apt update && sudo apt -y upgrade
With this single line we do two things: the first is to refresh the cache of the repositories and the second is to update them without being asked if we want to do it.
Once our system is updated with the latest security patches, the next thing we need to do is install a LAMP server. We can do it with the following instructions, always from the terminal:
sudo apt install apache2 libapache2-mod-php7.2 mysql-server-5.7 mysql-client php7.2 php7.2-mysql php7.2-curl php7.2-json php7.2-cgi php-xml php-mbstring php-bcmath
Already with that we will have a basic LAMP server running on our system.
Then we must change our timezone in the php.ini file. As an example I will put America/Caracas.
sudo nano /etc/php/7.2/apache2/php.ini
For the changes to take effect, we must restart the apache service2.
sudo systemctl restart apache2.service
Now we can add the Zabbix repository for Ubuntu 18.04 and then install it using the APT package manager. To add the repository just install a.deb file that we download with the following command:
and then we install it with:
sudo dpkg -i zabbix-release_3.4-1+bionic_all.deb
As we have added a new repository, we must refresh the cache of it, we do it with:
sudo apt update
And we proceed to install in a single command: the Zabbix server, the agent and the front-end to access from the web browser:
sudo apt install zabbix-server-mysql zabbix-agent zabbix-frontend-php
At this point, we already have Zabbix installed but we need to configure mysql so that the program knows how to use it.
Where we will define our root key. The rest of the questions can be answered according to our taste. In my case, I said: Y,N,Y,Y.
Now we must log in to mysql with the password we have previously defined, to create the database and the zabbix user.
sudo mysql -u root -p
CREATE DATABASE zabbix;
And select the database with:
Now we must create a mysql user that has permissions on the Zabbix database.
GRANT ALL ON zabbix.* TO ‘zabbixuser’@’localhost’ IDENTIFIED BY ‘zabbixpss’;
We briefly explain: zabbix is the database; zabixuser is the username mysql and zabbixpss is the password for that username. Obviously when you do the tutorial don’t tell anyone the password 😉
Now we leave mysql writing exit
At this point we must enable the ubuntu root user for the following commands to work.
sudo passwd root
it will ask us for a new password and that’s it.
We log in as root:
Next, copy the mysql configuration to the new user.
zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql -uzabbix -p zabbix
Defining the basic settings of Zabbix
We are almost finished, for now we have to define some parameters in the Zabbix configuration file so that it can work correctly.
We must modify these parameters so that you can communicate with mysql:
For these changes to take effect we must restart the Zabbix, apache and mysql services.
systemctl restart apache2.service
Next, the zabbix server:
systemctl restart zabbix-server.service
And Finally, mysql:
systemctl restart mysql.service
We have finally completed the process, and can view your front-end from the web browser.
and we should see something like this.
We click on next
After clicking on next we are presented with a screen where we must enter the mysql configuration parameters:
Then we can name the zabbix instance that we have just created:
You will then give us the summary of the pre-installation:
And finally, we did it: Zabbix-server is installed!!
When you access the zabbix directory again from your browser, you will be able to log in.
To log in as administrator, the user is admin and the password is zabbix, with this we will enter the dashboard
Of course, in this instantiation the Dashboard is empty, the agent is already installed in the machines to be monitored, and then add them to Zabbix.
Zabbix is a very useful server tool for monitoring services and today we have learned how to install it in our Ubuntu Server 18.04.
Please share this article through your social networks.