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.
IMPORTANTOpenSSH 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:
sudo apt install openssh-server
NOTETo connect to the server from a Windows system, you can use tools like PuTTY or MobaXterm.
NOTEThis guide walks you through connecting to a server with the iTerm2 terminal emulator on macOS.
CAUTIONYou will need to open the following TCP ports for access to the services:
- 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.
NOTETo 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:
wget https://repo.zabbix.com/zabbix/6.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.4-1+ubuntu22.04_all.deb
Install the Zabbix repository configuration package using the command:
sudo dpkg -i zabbix-release_6.4-1+ubuntu22.04_all.deb
Update the local package index to the latest changes in the repositories using the command:
sudo apt update
Now let’s install the packages required for Multicraft to work using the command:
sudo apt install -y apache2 apt-transport-https certbot python3-certbot-apache mysql-server zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-sql-scripts zabbix-agent
NOTEIn 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:
sudo a2enmod rewrite
NOTEThe “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:
sudo vim /etc/apache2/sites-available/zabbix.heyvaldemar.net.conf
NOTEIn 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.
NOTEIn 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 "
We activate the created virtual host using the command:
sudo a2ensite zabbix.heyvaldemar.net.conf
NOTEIn 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:
sudo a2dissite 000-default.conf
Verify that there are no errors in the syntax of the new Apache config file using the command:
sudo apache2ctl configtest
Restart Apache to apply the changes made using the command:
sudo systemctl restart apache2
Let’s check that Apache has started successfully using the command:
sudo systemctl status apache2
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.
NOTETo 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.
NOTEIn 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:
sudo certbot --apache -d zabbix.heyvaldemar.net
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”.
NOTECryptographic 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:
sudo certbot renew --dry-run
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:
sudo mysql_secure_installation
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.
NOTEIn 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.
NOTEIf 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.
NOTEIn 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:
sudo mysql -u root -p
Specify the password for the “root” account, set it earlier, and press the “Enter” button.
NOTEThis 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:
CREATE DATABASE zabbixdb CHARACTER SET utf8 COLLATE utf8mb4_bin;
NOTEIn this tutorial, “zabbixdbuser” with the password “c@e3wY88nx63c^4w^43r” will be used as the username with database rights to run Zabbix.
Create a user and assign a password to it using the command:
CREATE USER 'zabbixdbuser'@'localhost' IDENTIFIED BY 'c@e3wY88nx63c^4w^43r';
We grant the new user rights to the previously created database using the command:
GRANT ALL ON zabbixdb.* TO 'zabbixdbuser'@'localhost';
Apply the changes made using the command:
FLUSH PRIVILEGES;
Disconnect from the MySQL Management Console using the command:
quit
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.
NOTEIn 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:
zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql --default-character-set=utf8mb4 -u zabbixdbuser -p zabbixdb
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:
sudo vim /etc/zabbix/zabbix_server.conf
NOTEIn 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.
NOTEIn 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 "
Now you need to make changes to the Apache configuration file by opening it in a text editor using the command:
sudo vim /etc/zabbix/apache.conf
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.
You can view the full list of supported time zones in the official PHP documentation.
Now press the “Esc” button to exit edit mode, then type "
Restart Zabbix, Zabbix Agent, and Apache to apply the changes, using the command:
sudo systemctl restart zabbix-server zabbix-agent apache2
Check that Zabbix has started successfully using the command:
sudo systemctl status zabbix-server
Check that Zabbix Agent has started successfully using the command:
sudo systemctl status zabbix-agent
Let’s check that Apache has started successfully using the command:
sudo systemctl status apache2
Enable autorun of Zabbix, Zabbix Agent, and Apache when starting the operating system using the command:
sudo systemctl enable zabbix-server zabbix-agent apache2
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”.
NOTEIn 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”.
NOTEIn 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.
Patreon Exclusives
🏆 Join my Patreon and dive deep into the world of Docker and DevOps with exclusive content tailored for IT enthusiasts and professionals. As your experienced guide, I offer a range of membership tiers designed to suit everyone from newbies to IT experts.
Tools I Personally Trust
If you’re building things, breaking things, and trying to keep your digital life a little saner (like every good DevOps engineer), these are two tools that I trust and use daily:
🛸 Proton VPN - My shield on the internet. It keeps your Wi-Fi secure, hides your IP, and blocks those creepy trackers. Even if I’m hacking away on free café Wi-Fi, I know I’m safe.
🔑 Proton Pass - My password vault. Proper on-device encryption, 2FA codes, logins, secrets - all mine and only mine. No compromises.
These are partner links - you won’t pay a cent more, but you’ll be supporting DevOps Compass. Thanks a ton - it helps me keep this compass pointing the right way 💜
Gear & Books I Trust
📕 Essential DevOps books
🖥️ Studio streaming & recording kit
📡 Streaming starter kit
Social Channels
🎬 YouTube
🐦 X (Twitter)
🎨 Instagram
🐘 Mastodon
🧵 Threads
🎸 Facebook
🦋 Bluesky
🎥 TikTok
💻 LinkedIn
📣 daily.dev Squad
✈️ Telegram
🐈 GitHub
Community of IT Experts
👾 Discord
Refill My Coffee Supplies
💖 PayPal
🏆 Patreon
🥤 BuyMeaCoffee
🍪 Ko-fi
💎 GitHub
⚡ Telegram Boost
🌟 Bitcoin (BTC): bc1q2fq0k2lvdythdrj4ep20metjwnjuf7wccpckxc
🔹 Ethereum (ETH): 0x76C936F9366Fad39769CA5285b0Af1d975adacB8
🪙 Binance Coin (BNB): bnb1xnn6gg63lr2dgufngfr0lkq39kz8qltjt2v2g6
💠 Litecoin (LTC): LMGrhx8Jsx73h1pWY9FE8GB46nBytjvz8g
Is this content AI-generated?
No. Every article on this blog is written by me personally, drawing on decades of hands-on IT experience and a genuine passion for technology.
I use AI tools exclusively to help polish grammar and ensure my technical guidance is as clear as possible. However, the core ideas, strategic insights, and step-by-step solutions are entirely my own, born from real-world work.
Because of this human-and-AI partnership, some detection tools might flag this content. You can be confident, though, that the expertise is authentic. My goal is to share road-tested knowledge you can trust.