We will demonstrate how to install the zabbix server on a Linux machine with Ubuntu.
Downloading Zabbix
Initially, let’s access the zabbix page using the browser.
Next let’s click on Downloads.
After that, let’s select installation by Zabbix Packages.
Now we will choose the version of Zabbix and the operating system we will install. In our case, we are using ubuntu 22.
So let’s choose the latest version of zabbix and select Ubuntu.
Next let’s select Ubuntu version = 22.
Note. If we were using another Linux distribution, we could choose the installation type at that time.
Also, let’s choose the zabbix componet = Server, Frontend, Agent. That way we can install the zabbix server and also a local zabbix agent.
After that, we will select the database that we will use. In this case, let’s use MySQL.
Now, let’s select the WEB server that will host the zabbix frontend. In this tutorial, we will choose Apache.
Installing Zabbix Server
Now, let’s scroll down the page and let’s start the zabbix installation part. For this, we will use the commands described on the website.
First we will choose the location where we will download the Zabbix repository on our computer.
In this case, we will choose the Downloads folder. However, the user can choose another folder.
cd Downloads
Next let’s download zabbix with the command below:
wget https://repo.zabbix.com/zabbix/6.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.4-1+ubuntu22.04_all.deb
Note. Remember that when you are following this tutorial, the version of Zabbix may have changed; if that happens, you can replace the command above with the command described on the Zabbix website.
Now we are going to install the “.deb” file that we downloaded.
For this, we will use the command below:
sudo dpkg -i zabbix-release*
Next let’s do the update
sudo apt update
Now we will install zabbix and the necessary components for the Zabbix server to work.
For that, let’s use the command below.
sudo apt install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-sql-scripts zabbix-agent
To confirm the installation, type “Y” and then press ENTER.
The figure below shows the completed installation.
Creating the database for zabbix
To create the database for zabbix we will use the command below.
sudo mysql -uroot -p
How to resolve Can’t connect to local MySQL server through socket error
If an error like the one in the figure below appears.
Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock
This means you don’t have mysql-server installed yet.
So let’s install mysql-server using the command below.
sudo apt-get install mysql-server
Note. We assume the machine we are installing Zabbix on did not previously have a MySQL database.
Creating the database
Next, we need to enter a password for the database. In this example, let’s use password = 123456
Now let’s type the command below.
create database zabbix character set utf8mb4 collate utf8mb4_bin;
Next, let’s type the command below.
create user zabbix@localhost identified by ‘password‘;
Instead of ‘password’ let’s use our password which is 123456. So in our case the command will be :
create user zabbix@localhost identified by '123456';
Now, let’s grant privileges to the database with the command below.
grant all privileges on zabbix.* to zabbix@localhost;
Next let’s use the command below.
set global log_bin_trust_function_creators = 1;
Finally let’s finish with the command below.
quit;
Importing Zabbix server and initial schema
To import the initial schema and data, let’s use the command below.
Remember that after the command, we will be asked for the password we used. Therefore, we will use the same password that we used earlier. Therefore, our password is 123456.
sudo zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix
Note. After entering your password, it is common to take a long time to process. So take it easy.
Disabling the log_bin_trust_function_creators option
The zabbix website recommends that we disable the log_bin_trust_function_creators option. So let’s disable it using the commands below.
sudo mysql -uroot -p
Then we will use the same password that we created earlier, and ours is 123456.
Next, let’s use the command below.
set global log_bin_trust_function_creators = 0;
Now, let’s finish with the command below.
quit;
Configuring Zabbix server access
To do this, let’s enter the /etc/zabbix/zabbix_server.conf file.
Let’s use the command below.
sudo nano /etc/zabbix/zabbix_server.conf
Next let’s look for the DBPassword= line and let’s include our password 123456.
DBPassword=123456
After that, let’s save the changes and exit the nano editor.
Start Zabbix server and agent
To start the zabbix server, the zabbix agent and the apache server let’s use the command below.
sudo systemctl restart zabbix-server zabbix-agent apache2
Now, let’s configure so that the zabbix server, zabbix agent and apache server are started together with the operating system.
sudo systemctl enable zabbix-server zabbix-agent apache2
Starting zabbix in browser
Let’s open a browser and type the link below.
http://localhost/zabbix
In this case we are accessing zabbix using the loopback address = localhost which can also be replaced by “127.0.0.1”.
To access the Zabbix server from another machine, you must enter the Zabbix server machine IP in the client machine’s browser, as in the example below.
http://zabbix_serverIP/zabbix
After choosing the language, click on “Next step”.
Next, we will check the prerequisites as shown in the figure below. Then let’s click on “Next step.
After checking the prerequisites, let’s now configure database access.
For this, we will include the password that we defined earlier.
In this case, our password was 123456. Then we will click on “Next step.
Now let’s define the Zabbix server name and the time zone.
In our example, we will use the name “my_zabbix” and the time zone of Sao Paulo. Then we will click on “Next step.
Next is a pre-installation summary. In this case, we will just confirm and click on “Next step.
In the figure below, we can see that we managed to install the zabbix server fronted.
So let’s click Finish.
Starting the frontend of the zabbix server
Now, let’s start typing the default user which in this case is “Admin” and the password which in this case is “zabbix”.
No quotes.
Finally we have zabbix installed and we will see a page like the one below.
See also:
How to install Zabbix on Raspberry Pi
Juliana Mascarenhas
Data Scientist and Master in Computer Modeling by LNCC.
Computer Engineer
Tutorial how to Install and configure VNC on Ubuntu
Remote access has become an essential tool for managing servers and desktops, enabling administrators and…
Build Your Own DNS Server: A Step-by-Step Guide using BIND9
In this step-by-step guide, we’ll walk you through the entire process of setting up and…
Tutorial for SSH Public Key Authentication
In this tutorial, we will teach you how to create and configure access to an…
Socket UDP Python Chat
Tutorial for creating a simple chat using UDP sockets in Python 3. The goal is…
Socket TCP Python make a chat
Tutorial for creating a simple chat using TCP sockets in Python 3. The goal is…
apt get behind proxy
Over time, I have often come across the need to configure apt get to work…