Install Zabbix on Ubuntu Server
This article is for those looking for a detailed and straightforward guide on installing Zabbix on Ubuntu Server.
Zabbix is an open-source, enterprise-class distributed monitoring solution.
In this guide, we will consider the case when you already have a server with the Ubuntu Server 22.04 LTS operating system installed on it.
You can read more about how to install Ubuntu Server 22.04 LTS in my guide “Install Ubuntu Server 22.04 LTS”.
In addition, OpenSSH must be installed on the server, and port 22 must be open in order to be able to connect to the server using the SSH protocol.
To install OpenSSH on a server, you can use the command:
If you plan to connect to the server using the Windows operating system, you can use PuTTY or MobaXterm.
This guide describes how to connect to a server using the iTerm2 terminal emulator installed on the macOS operating system.
Please note that you will need to open the following TCP ports to access your server:
- TCP port 80 - to get a free cryptographic certificate through Let’s Encrypt CA.
- TCP port 443 - to access the Zabbix frontend.
- TCP port 10050 - for Zabbix Agent to work.
- TCP port 10051 - for Zabbix Trapper to work.
We connect to the server on which you plan to install Zabbix.
To obtain and subsequently renew a free SSL certificate, we will use the Let’s Encrypt certification authority, as well as the Certbot software client, which is designed to make it as easy as possible to obtain and renew a certificate through the Let’s Encrypt certification authority.
Now you need to download and install the Zabbix repository configuration package.
Download the Zabbix repository configuration package using the command:
Install the Zabbix repository configuration package using the command:
Update the local package index to the latest changes in the repositories using the command:
Now let’s install the packages required for Multicraft to work using the command:
Please note that in this tutorial, MySQL will be used as a database management system, and Apache will be used as a webserver.
We enable the Apache webserver module called “rewrite” using the command:
Note that the “rewrite” module is one of the most commonly used modules in the Apache webserver and provides a flexible and powerful way to manipulate URLs.
Now you need to create a virtual host file (called a block in Nginx), with which Zabbix will work in the future.
Let’s create a virtual host file using a text editor using the command:
In this tutorial, the zabbix.heyvaldemar.net subdomain will be used to access the Zabbix control panel from the Internet. You will need to specify your domain or subdomain by which your Zabbix will be accessible from the Internet.
Hit the “i” button to go into edit mode, then insert the following configuration for the webserver to work.
In this tutorial, the zabbix.heyvaldemar.net subdomain will be used to access Zabbix from the Internet. You will need to specify your domain or subdomain by which your Zabbix will be accessible from the Internet.
Now press the “Esc” button to exit edit mode, then type “:x” and press the “Enter” button to save your changes and exit the editor.
We activate the created virtual host using the command:
In this tutorial, the zabbix.heyvaldemar.net subdomain will be used to access the Zabbix control panel from the Internet. You will need to specify your domain or subdomain by which your Zabbix will be accessible from the Internet.
Deactivate the default virtual host using the command:
Verify that there are no errors in the syntax of the new Apache config file using the command:
Restart Apache to apply the changes made using the command:
Let’s check that Apache has started successfully using the command:
Now, in order to increase the security level of the webserver, you need to obtain a cryptographic certificate for the domain or subdomain through which your Zabbix will be accessible from the Internet.
To obtain and subsequently renew a free SSL certificate, we will use the Let’s Encrypt certification authority, as well as the Certbot software client, which is designed to make it as easy as possible to obtain and renew a certificate through the Let’s Encrypt certification authority.
In this tutorial, the zabbix.heyvaldemar.net subdomain will be used to access the Zabbix control panel from the Internet. You will need to specify your domain or subdomain by which your Zabbix will be accessible from the Internet.
Request a cryptographic certificate using the command:
Next, we indicate the email address to which Let’s Encrypt will send notifications about the expiration of the cryptographic certificate and press the “Enter” button.
The next step is to read and accept the terms of use of the services provided.
Press the button “a”, then “Enter”, if you agree with the terms of use of the services provided.
The next step is to choose whether you would like to share the above email address with the Electronic Frontier Foundation in order to receive newsletters.
Press the “n” button, then “Enter”.
At the next stage, you need to choose: do you want the parameters to be automatically added to the Apache configuration file for automatically redirecting HTTP traffic to HTTPS.
Press the button “2”, then “Enter”.
Please note that cryptographic certificates obtained through Let’s Encrypt CA are valid for ninety days. Certbot automatically adds a script to renew the certificate to the task scheduler and the script runs twice a day, automatically renewing any cryptographic certificate that expires within thirty days.
You can check the functionality of the cryptographic certificate renewal process using the command:
Now let’s configure MySQL for further work with Zabbix.
First, you need to run the “mysql_secure_installation” script, which is designed to provide a basic level of MySQL security.
Run the script using the command:
Next, you need to answer a few questions to ensure a basic level of MySQL security.
The first question is whether you want to use the password strength plugin, which will need to be set later for the “root” user who has administrator rights in MySQL.
Press the “y” button, then “Enter”.
The next step is to select the level of password complexity checking, which will need to be set later for the “root” user who has administrator rights in MySQL.
In this tutorial, we will look at the highest level of password strength checking for the “root” user.
Press the button “2”, then “Enter”.
The next step is to provide a strong password for the “root” user who has administrator rights in MySQL.
Specify a strong password for the “root” user and press the “Enter” button.
Next, specify the password for the “root” user again and press the “Enter” button.
The next question is if you would like to proceed to the next step in setting up a basic MySQL security level with the obtained password strength value.
Please note that if the password you specified will have a value of “Estimated strength of the password” less than 100, it means that the password you specified earlier for the “root” user is not strong enough, and you need to specify a stronger password.
In this tutorial, the “Estimated strength of the password” value is 100, which indicates that the previously specified password is strong enough.
Press the “y” button, then “Enter”.
The next question is if you want to delete anonymous users.
Press the “y” button, then “Enter”.
The next question is if you want to disable remote MySQL connectivity for the “root” user.
Press the “y” button, then “Enter”.
The next question is if you want to drop the test databases.
Press the “y” button, then “Enter”.
Now you need to apply the changes you made.
Press the “y” button, then “Enter”.
Now you need to create a database that Zabbix will use in the future, as well as a user with the necessary rights to this database.
We connect to the MySQL management console using the command:
Specify the password for the “root” account, set it earlier, and press the “Enter” button.
This tutorial will use “zabbixdb” as the database name for Zabbix.
Let’s create a database that Zabbix will use in the future using the command:
In this tutorial, “zabbixdbuser” with the password “c@e3]Y88n)63}^4w^43]” will be used as the username with database rights to run Zabbix.
Create a user and assign a password to it using the command:
We grant the new user rights to the previously created database using the command:
Apply the changes made using the command:
Disconnect from the MySQL Management Console using the command:
Now you need to configure the schema and import the data into the previously created database for Zabbix to work.
This tutorial uses “zabbixdb” as the database name for the Zabbix operation.
In this tutorial, “zabbixdbuser” is used as the username with database rights to run Zabbix.
Let’s configure the schema and import the data into the previously created database using the command:
Specify the password for the “zabbixdbuser” account specified earlier and press the “Enter” button.
Now you need to make changes to the Zabbix configuration file by opening it in a text editor using the command:
In this tutorial, the database for Zabbix to work is on the same server as Zabbix.
Press the “i” button to switch to edit mode, find the “DBHost” parameter and uncomment it by removing the “#” symbol. Then we specify the value “localhost” for the parameter.
This tutorial uses “zabbixdb” as the database name for Zabbix operation.
Find the “DBName” parameter and specify the value “zabbixdb” for the parameter.
In this tutorial, “zabbixdbuser” is used as the username with database rights to run Zabbix.
Find the “DBUser” parameter and specify the value “zabbixdbuser” for the parameter.
Find the “DBPassword” parameter and uncomment it by removing the “#” symbol. Then, as the value for the parameter, we specify the password assigned to the “zabbixdbuser” user.
Now press the “Esc” button to exit edit mode, then type “:x” and press the “Enter” button to save your changes and exit the editor.
Now you need to make changes to the Apache configuration file by opening it in a text editor using the command:
Next, find the “php_value date.timezone Europe/Riga” parameter in the “IfModule mod_php7.c” section and uncomment it by removing the “#” symbol. Then we indicate instead of “Europe/Riga”, the time zone in which your Zabbix server is located.
A list of supported time zones can be found here.
Now press the “Esc” button to exit edit mode, then type “:x” and press the “Enter” button to save your changes and exit the editor.
Restart Zabbix, Zabbix Agent, and Apache to apply the changes, using the command:
Check that Zabbix has started successfully using the command:
Check that Zabbix Agent has started successfully using the command:
Let’s check that Apache has started successfully using the command:
Enable autorun of Zabbix, Zabbix Agent, and Apache when starting the operating system using the command:
To continue the Zabbix installation process, you need to go from the workstation to the link https://zabbix.heyvaldemar.net/setup.php, where zabbix.heyvaldemar.net is the name of my server. Accordingly, you need to specify the name or IP address of your Zabbix server.
Click on the “Next step” button.
Next, the installer will check that all the requirements for the correct installation of Zabbix are met.
Click on the “Next step” button.
Now you need to specify the system for managing the databases and the previously created database that will be used to run Zabbix.
In the “Database type” field, select “MySQL”.
In this tutorial, the database for Zabbix to work is on the same server as Zabbix.
In the “Database host” field, specify “localhost”.
In the “Database port” field, specify the value “0” to use the default port for connecting the database.
This tutorial uses “zabbixdb” as the database name for the Zabbix operation.
In the “Database name” field, specify “zabbixdb”.
In this tutorial, “zabbixdbuser” is used as the username with database rights to run Zabbix.
In the “User” field, specify “zabbixdbuser”.
In the “Password” field, specify the password assigned to the “zabbixdbuser” user.
Click on the “Next step” button.
Next, you need to specify information about your Zabbix server.
In the “Host” field, specify “localhost”.
In the “Port” field, enter “10051”.
Click on the “Next step” button.
We check that the time zone is set correctly and click on the “Next step” button.
Then click on the “Next step” button to save the changes.
Everything is ready to use Zabbix.
Click on the “Finish” button.
Now you can log into the Zabbix dashboard as a Zabbix administrator.
Login for Zabbix administrator account by default: Admin
The default password for Zabbix administrator account: zabbix
Specify the username and password of an account with Zabbix administrator rights and click on the “Sign in” button.
Welcome to the Zabbix dashboard.
My Courses
🎓 Dive into my comprehensive IT courses designed for enthusiasts and professionals alike. Whether you’re looking to master Docker, conquer Kubernetes, or advance your DevOps skills, my courses provide a structured pathway to enhancing your technical prowess.
My Services
💼 Take a look at my service catalog and find out how we can make your technological life better. Whether it’s increasing the efficiency of your IT infrastructure, advancing your career, or expanding your technological horizons — I’m here to help you achieve your goals. From DevOps transformations to building gaming computers — let’s make your technology unparalleled!
Refill My Coffee Supplies
💖 PayPal
🏆 Patreon
💎 GitHub
🥤 BuyMeaCoffee
🍪 Ko-fi
Follow Me
🎬 YouTube
🐦 Twitter
🎨 Instagram
🐘 Mastodon
🧵 Threads
🎸 Facebook
🧊 Bluesky
🎥 TikTok
🧩 LeetCode
🐈 GitHub
Is this content AI-generated?
Nope! Each article is crafted by me, fueled by a deep passion for Docker and decades of IT expertise. While I employ AI to refine the grammar—ensuring the technical details are conveyed clearly—the insights, strategies, and guidance are purely my own. This approach may occasionally activate AI detectors, but you can be certain that the underlying knowledge and experiences are authentically mine.