Install and Configure Zabbix 6.0 on Ubuntu 22.04

This tutorial intends to teach you to Install and Configure Zabbix 6.0 LTS on Ubuntu 22.04. As you know Zabbix is a powerful, easy to set up, and open-source monitoring tool. It is used to monitor many things, such as servers, networks, IT components, cloud services, and virtual machines. 

The most amazing features of Zabbix include:

  • Visualization
  • Zabbix API
  • Notification and remediation
  • Effortless deployments
  • Security and authentication
  • Metric collection
  • Problem detection
  • Distributed monitoring

In this guide, you will learn to set up Zabbix 6.0 which is the latest stable version on Ubuntu 22.04 by using the LAMP Stack.

How To Install and Configure Zabbix 6.0 LTS on Ubuntu 22.04?

To complete this guide, you must have access to your server as a non-root user with sudo privileges and set up a basic firewall. For this purpose, you can visit the Initial Server Setup with Ubuntu 22.04.

Also, you must have Apache, MariaDB, and PHP installed on your server. To do this, you can visit this guide on How To Install LAMP Stack on Ubuntu 22.04.

Now follow the steps below to start your Zabbix installation.

Step 1 – Configure PHP for Zabbix 6.0 on Ubuntu 22.04

First, you need to install some PHP extensions for Zabbix on Ubuntu 22.04 with the following command:

sudo apt install php-mbstring php-gd php-xml php-bcmath php-ldap php-mysql -y

Then, you need to edit the php.ini file and make some configuration changes. Open the file with your favorite text editor, here we use vi:

sudo vi /etc/php/8.1/apache2/php.ini

In the file, find the lines below and change the values as shown below:

memory_limit = 256M
upload_max_filesize 16M
post_max_size 16M
max_execution_time 300
max_input_time 300

Also, find the lines below and uncomment them by removing the “:” from the beginning of the line and setting them to:

max_input_vars 10000
date.timezone = Etc/UTC

Note: Remember to set your correct timezone.

When you are done, save and close the file.

Then, restart Apache to apply the changes with the command below:

sudo systemctl restart apache2

Step 2 – Create Zabbix Database and Database User

Now you need to create a database and user for the Zabbix on Ubuntu 22.04. 

Log in to your MariaDB console with the command below:

sudo mysql -u root -p

Then, from your MariaDB shell run the command below to create a Zabbix database:

MariaDB [(none)]> CREATE DATABASE zabbixdb character set utf8 collate utf8_bin;

Next, run the following command to create a user with a strong password:

MariaDB [(none)]> CREATE USER 'zabbixuser'@'localhost' IDENTIFIED BY 'password';

Here you need to grant all the privileges to the Zabbix database and database user with the following command and enable the log_bin_trust_function_creators option:

MariaDB [(none)]> GRANT ALL PRIVILEGES ON zabbixdb.* TO 'zabbixuser'@'localhost' WITH GRANT OPTION;
MariaDB [(none)]> set global log_bin_trust_function_creators = 1;

Flush the privileges and exit from your MariaDB console with the following commands:

MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;

Step 3 – Download and Install Zabbix 6.0 on Ubuntu 22.04

To install Zabbix on Ubuntu 22.04, you need to visit the Zabbix Downloads page and find the latest LTS version.

Then, use the following commands to add the Zabbix 6.0 LTS repository:

# sudo wget https://repo.zabbix.com/zabbix/6.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.0-4+ubuntu22.04_all.deb
# sudo dpkg -i zabbix-release_6.0-4+ubuntu22.04_all.deb

Next, run the system update:

sudo apt update

Now use the following command to install the Zabbix server, frontend, and agent on Ubuntu 22.04:

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

Step 4 – Start and Enable Zabbix Server on Ubuntu 22.04

At this point, you need to start and enable your Zabbix server to start on boot with the commands below:

# sudo systemctl start zabbix-server
# sudo systemctl enable zabbix-server

Verify that your Zabbix server is active and running on your Ubuntu 22.04:

sudo systemctl status zabbix-server

In your output you will see:

Output
● zabbix-server.service - Zabbix Server
     Loaded: loaded (/lib/systemd/system/zabbix-server.service; enabled; vendor>
     Active: active (running) since Wed 2023-05-31 10:39:04 UTC; 21s ago
   Main PID: 15800 (zabbix_server)
      Tasks: 1 (limit: 4575)
     Memory: 3.1M
        CPU: 53ms
     CGroup: /system.slice/zabbix-server.service
             └─15800 /usr/sbin/zabbix_server -c /etc/zabbix/zabbix_server.conf

Step 5 – How To Import Zabbix Database Schema?

At this point, you need to import the Zabbix database schema.

To do this, use the following command to import the Zabbix database on Ubuntu 22.04:

zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbixuser -p zabbixdb

Enter your database user password and wait to be finished.

Then, after importing your database, you need to disable the log_bin_trust_function_creators option. To do this, log in to your MariaDB console and run the command below:

sudo mysql -u root -p
MariaDB [(none)]> set global log_bin_trust_function_creators = 0;
MariaDB [(none)]> quit;

Step 6 – Edit Zabbix Configuration File on Ubuntu 22.04

Here you need to edit the Zabbix default configuration file and define the database settings. Open the file with your favorite text editor, here we use the vi editor:

sudo vi /etc/zabbix/zabbix_server.conf

Find the lines below and uncomment them by removing the “#” from the beginning of the line and changing them to your database settings.

DBHost=localhost
DBName=zabbixdb
DBUser=zabbixuser
DBPassword=password

When you are done, save and close the file.

Restart your Zabbix and Apache on Ubuntu 22.04 to apply the changes with the following commands:

# sudo systemctl restart zabbix-server
# sudo systemctl restart apache2

Step 6 – Configure Zabbix 6.0 Agent on Ubuntu 22.04

At this point, you need to configure the Zabbix agent on your Ubuntu 22.04. Open the file with your favorite text editor, here we use vi:

sudo vi /etc/zabbix/zabbix_agentd.conf

Find the lines below and change the values as shown below:

Server=127.0.0.1
ServerActive=127.0.0.1
Hostname=Zabbix Server

When you are done, save and close the file.

Start and enable the Zabbix agent to start on boot with the commands below:

# sudo systemctl start zabbix-agent
# sudo systemctl enable zabbix-agent

Verify that your Zabbix agent is active and running on your Ubuntu 22.04:

sudo systemctl status zabbix-agent

In your output you will see:

Output
● zabbix-agent.service - Zabbix Agent
     Loaded: loaded (/lib/systemd/system/zabbix-agent.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2023-05-31 10:38:02 UTC; 19min ago
   Main PID: 15354 (zabbix_agentd)
      Tasks: 6 (limit: 4575)
     Memory: 6.3M
        CPU: 671ms
     CGroup: /system.slice/zabbix-agent.service
             ├─15354 /usr/sbin/zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf
...

Step 7 – How To Access Zabbix 6.0 Dashboard?

At this point, you can access your Zabbix dashboard by typing your server’s IP address in your web browser followed by /Zabbix:

http://your-server-ip/zabbix

You will see the Zabbix welcome page, choose your desired language and click on the next step.

Zabbix 6.0 select language

In the next window, you will see the check for the prerequisites. Make sure all the required PHP extensions are installed then click on the Next step button.

check for the prerequisites of Zabbix 6.0 Ubuntu 22.04

Then, you will see the configure DB connection page. Enter your database details and click on the next step.

Configure Zabbix DB connection

Next, you need to set your Zabbix server details like your server name and default theme, and press the next step.

Zabbix server settings

Now check the Zabbix pre-installation summary and click on the next step.

Zabbix 6.0 ore-installation

When your installation is completed, you will see the following page:

Install Zabbix frontend Ubuntu

Click on the finish button and you will see the Zabbix login screen. Enter the Admin as a username and zabbix as a password and click on the sign-in button.

Zabbix log in screen

Here you will see your Zabbix dashboard on Ubuntu 22.04:

Zabbix 6.0 dashboard

Step 8 – How To Change Zabbix Admin User Password?

From your Zabbix dashboard, you can easily change your administrator user password for more security. To do this, click on Administration from the left side of the dashboard and click Users, and click on your Admin user.

Zabbix administration users

Then, click on change password as shown below:

Change Zabbix admin user password

Enter your desired password for your Zabbix admin password on Ubuntu 22.04 and click Update.

Update admin password for Zabbix 6.0 ubuntu 22.04

That’s it, you are done.

Conclusion

At this point, you have learned to Install and Configure Zabbix 6.0 LTS Server and Agent on Ubuntu 22.04. Zabbix is one of the best software that you can use to monitor your servers, networks, IT components, cloud services, and virtual machines. 

Hope you enjoy it. You may be interested in these articles:

How To Install Mattermost on Ubuntu 22.04

Install and Use DirectAdmin on Ubuntu 22.04

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Stay informed and not overwhelmed, subscribe now!