How to install Zabbix on Ubuntu 22.04

To Install Zabbix On Ubuntu 22.04

Introduction:

Zabbix is an open-source software tool designed for monitoring IT infrastructure, including networks, servers, virtual machines, and cloud services. It effectively collects and displays key metrics related to network utilization, CPU load, and disk space consumption.

Procedure Steps:

Step 1: Check the OS version by using the below command

root@linuxhelp:~# lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 22.04.3 LTS
Release:	22.04
Codename:	jammy

Step 2: Download the Debian package by running the below command

root@linuxhelp:~# wget https://repo.zabbix.com/zabbix/6.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.4-1+ubuntu22.04_all.deb
--2024-04-27 07:53:22--  https://repo.zabbix.com/zabbix/6.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.4-1+ubuntu22.04_all.deb
Resolving repo.zabbix.com (repo.zabbix.com)... 178.128.6.101, 2604:a880:2:d0::2062:d001
Connecting to repo.zabbix.com (repo.zabbix.com)|178.128.6.101|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3744 (3.7K) [application/octet-stream]
Saving to: ‘zabbix-release_6.4-1+ubuntu22.04_all.deb’
zabbix-release_6.4-1+ubuntu22.04_ 100%[==========================================================>]   3.66K  --.-KB/s    in 0s      

2024-04-27 07:53:23 (456 MB/s) - ‘zabbix-release_6.4-1+ubuntu22.04_all.deb’ saved [3744/3744]

Step 3: Install the Zabbix repository package by using the below command

root@linuxhelp:~# dpkg -i zabbix-release_6.4-1+ubuntu22.04_all.deb 
Selecting previously unselected package zabbix-release.
(Reading database ... 202332 files and directories currently installed.)
Preparing to unpack zabbix-release_6.4-1+ubuntu22.04_all.deb ...
Unpacking zabbix-release (1:6.4-1+ubuntu22.04) ...
Setting up zabbix-release (1:6.4-1+ubuntu22.04) ...

Step 4: Then update the repository by using the below command

root@linuxhelp:~# apt update
Hit:1 http://in.archive.ubuntu.com/ubuntu jammy InRelease                                    
Get:2 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]                    
Get:3 http://in.archive.ubuntu.com/ubuntu jammy-updates InRelease [119 kB]                         
Get:4 https://repo.zabbix.com/zabbix/6.4/ubuntu jammy InRelease [2,874 B]                                          
Get:5 https://repo.zabbix.com/zabbix/6.4/ubuntu jammy/main Sources [15.3 kB]                           
Get:6 http://in.archive.ubuntu.com/ubuntu jammy-backports InRelease [109 kB]
Get:7 https://repo.zabbix.com/zabbix/6.4/ubuntu jammy/main amd64 Packages [43.5 kB]
Get:8 https://repo.zabbix.com/zabbix/6.4/ubuntu jammy/main all Packages [9,042 B]
Get:9 http://security.ubuntu.com/ubuntu jammy-security/main i386 Packages [452 kB]
Get:10 http://in.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [1,610 kB]
Get:11 http://security.ubuntu.com/ubuntu jammy-security/main amd64 Packages [1,394 kB]
Fetched 13.2 MB in 8s (1,724 kB/s)                                                                                                  
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
282 packages can be upgraded. Run 'apt list --upgradable' to see them.
N: Skipping acquire of configured file 'main/binary-i386/Packages' as repository 'https://repo.zabbix.com/zabbix/6.4/ubuntu jammy InRelease' doesn't support architecture 'i386'

Step 5: Now execute the following command to install the Zabbix server, frontend, Apache configuration, SQL scripts, agent packages and Mysql server.

root@linuxhelp:~# apt install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-sql-scripts zabbix-agent mysql-server -y
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libflashrom1 libftdi1-2 libllvm13
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  apache2 apache2-bin apache2-data apache2-utils fonts-dejavu fonts-dejavu-extra fping libaio1 libapache2-mod-php
  libapache2-mod-php8.1 libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libcgi-fast-perl libcgi-pm-perl
  libevent-core-2.1-7 libevent-pthreads-2.1-7 libfcgi-bin libfcgi-perl libfcgi0ldbl libhtml-template-perl libmecab2 libmodbus5
  libmysqlclient21 libodbc2 libonig5 libopenipmi0 libprotobuf-lite23 mecab-ipadic mecab-ipadic-utf8 mecab-utils mysql-client-8.0
  mysql-client-core-8.0 mysql-common mysql-server-8.0 mysql-server-core-8.0 php-bcmath php-common php-gd php-ldap php-mbstring
  php-mysql php-xml php8.1-bcmath php8.1-cli php8.1-common php8.1-gd php8.1-ldap php8.1-mbstring php8.1-mysql php8.1-opcache
  php8.1-readline php8.1-xml snmpd
0 upgraded, 61 newly installed, 0 to remove and 282 not upgraded.
Need to get 58.4 MB of archives.
After this operation, 347 MB of additional disk space will be used.
Get:1 http://in.archive.ubuntu.com/ubuntu jammy-updates/main amd64 libapr1 amd64 1.7.0-8ubuntu0.22.04.1 [108 kB]
Get:2 https://repo.zabbix.com/zabbix/6.4/ubuntu jammy/main amd64 zabbix-server-mysql amd64 1:6.4.14-1+ubuntu22.04 [1,484 kB]
Get:3 http://in.archive.ubuntu.com/ubuntu jammy-updates/main amd64 libaprutil1 amd64 1.6.1-5ubuntu4.22.04.2 [92.8 kB]
Get:4 http://in.archive.ubuntu.com/ubuntu jammy-updates/main amd64 libaprutil1-dbd-sqlite3 amd64 1.6.1-5ubuntu4.22.04.2 [11.3 kB]
Get:5 http://in.archive.ubuntu.com/ubuntu jammy-updates/main amd64 libaprutil1-ldap amd64 1.6.1-5ubuntu4.22.04.2 [9,170 B]
Get:6 http://in.archive.ubuntu.com/ubuntu jammy-updates/main amd64 apache2-bin amd64 2.4.52-1ubuntu4.9 [1,347 kB]
Get:7 http://in.archive.ubuntu.com/ubuntu jammy-updates/main amd64 apache2-data all 2.4.52-1ubuntu4.9 [165 kB]
Get:8 https://repo.zabbix.com/zabbix/6.4/ubuntu jammy/main amd64 zabbix-agent amd64 1:6.4.14-1+ubuntu22.04 [265 kB]
Get:9 https://repo.zabbix.com/zabbix/6.4/ubuntu jammy/main all zabbix-frontend-php all 1:6.4.14-1+ubuntu22.04 [7,288 kB]
Processing triggers for fontconfig (2.13.1-4.2ubuntu5) ...
Processing triggers for php8.1-cli (8.1.2-1ubuntu2.15) ...
Processing triggers for libapache2-mod-php8.1 (8.1.2-1ubuntu2.15) ...

Step 6: Login to the MySQL console by using the below command

root@linuxhelp:~# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.36-0ubuntu0.22.04.1 (Ubuntu)
Copyright (c) 2000, 2024, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

Step 7: Create a database and set the character set and collation by using the below command

mysql> create database zabbix character set utf8mb4 collate utf8mb4_bin;
Query OK, 1 row affected (0.01 sec)

Step 8: Create a new Zabbix user and set a password by using the below command.

mysql> create user 'zabbix'@'%' identified by '123456';
Query OK, 0 rows affected (0.03 sec)

Step 9: Grant all privileges on the Zabbix database to the Zabbix user by using the below command.

mysql> grant all privileges on zabbix.* to 'zabbix'@'%';
Query OK, 0 rows affected (0.02 sec)

Step 10: Enable log_bin_trust_function_creators option by using the below command

mysql> set global log_bin_trust_function_creators = 1;
Query OK, 0 rows affected, 1 warning (0.00 sec)

Step 11: Now exit from MySQL console.

mysql> \q
Bye

Step 12: Import initial schema and data on Zabbix server host. You will be prompted to enter your newly created password by using the below command.

root@linuxhelp:~# zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix
Enter password: 

Step 13: Again login to the MySQL console by using the below command

root@linuxhelp:~# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.36-0ubuntu0.22.04.1 (Ubuntu)
Copyright (c) 2000, 2024, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

Step 14: Disable log_bin_trust_function_creators option after importing database schema by using the below command

mysql> set global log_bin_trust_function_creators = 0;
Query OK, 0 rows affected, 1 warning (0.00 sec)

Step 15: Exit from MySQL console.

mysql> \q
Bye

Step 16: Now configure the database for Zabbix server. Add the password in the configuration file by using the below command

root@linuxhelp:~# vim /etc/zabbix/zabbix_server.conf 
DBPassword=password

Step 17: Now restart and enable Zabbix services by using the below commands.

root@linuxhelp:~# systemctl restart zabbix-server zabbix-agent apache2
root@linuxhelp:~# systemctl enable zabbix-server zabbix-agent apache2
Synchronizing state of zabbix-server.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable zabbix-server
Synchronizing state of zabbix-agent.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable zabbix-agent
Synchronizing state of apache2.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable apache2
Created symlink /etc/systemd/system/multi-user.target.wants/zabbix-server.service → /lib/systemd/system/zabbix-server.service.

Step 18: Now open the browser and search with the following URL. http://localhost/zabbix

Step 19: Now the Zabbix setup page, has been appear. Click next step as shown in the below image.

Step 20: Here it checks for pre-requisites. Then click next step as shown in the below image.

Step 21: Need to configure Database here, by entering your password. Then click next step as shown in the below image.

Step 22: Set your server name here and click next step as shown in the below image.

Step 23: Now check the summary, then click next step as shown in the below image.

Step 24: Configuration has been completed. Now click finish button to complete setup as shown in the below image

Step 25: Now the login page will display. Enter Admin as username and Zabbix as password as shown in the below image.

Step – 26: This is the dashboard page of Zabbix

Conclusion:

We have reached the end of this article. In this guide, we have walked you through the steps required to installation of Zabbix on Ubuntu 22.04. Your feedback is much welcome.

FAQ
Q
How is data stored in Zabbix?
A
Zabbix stores data in a relational database (MySQL, PostgreSQL, SQLite, or Oracle) for long-term storage and uses in-memory caching for faster access.
Q
What types of devices can Zabbix monitor?
A
Zabbix can monitor servers, network devices, virtual machines, databases, applications, and more.
Q
How does Zabbix monitor devices and services?
A
Zabbix monitors devices and services using protocols such as SNMP, ICMP, JMX, IPMI, and customs checks.
Q
What is Zabbix?
A
Zabbix is an open-source monitoring and alerting solution designed to track the performance and availability of networks, servers, applications, and other IT resources.
Q
How do I migrate from one database to another?
A
Dump data only (for MySQL, use the flag -t or --no-create-info), create the new database using schema files from Zabbix, and import the data.