Installing Zabbix 6.0 LTS on Ubuntu 22.04 LTS
460 530 625
The installation instructions given here a valid for Zabbix 6.0 LTS, running on Ubuntu 22.04 LTS. You can find installation instructions for all the supproted platforms on the Download and install Zabbix page.
When a command requires elevated privileges, it is shown in this guide with the hashtag prompt: # apt update
One way to run a command with elevated privileges is by using the sudo command:
$ sudo apt update
To install the latest version, update the repositories first:
# apt update ⋮ All packages are up to date.
# apt install mysql-server ⋮ mysqld will log errors to /var/log/mysql/error.log mysqld is running as pid55555 ⋮ Setting up mysql-server ⋮
# service mysql status ⋮ Active: active (running) since Fri 2023-05-05 13:21:16 EEST; 8min ago ⋮ Status: "Server is operational" ⋮
If the server does not seem to be running properly, you can start it manually:
# service mysql restart
If needed, the server can be stopped by replacing restart with stop in the command above.
# ss -tap | grep mysql LISTEN 0 70 127.0.0.1:33060 0.0.0.0:* users:(("mysqld",pid=66666 ,fd=21)) LISTEN 0 151 127.0.0.1:mysql 0.0.0.0:* users:(("mysqld",pid=66666 ,fd=23))
To install the latest version, update the repositories first:
# apt update ⋮ All packages are up to date.
Note the number 2 at the end of the name of the package!
# apt install apache2 ⋮
# service apache2 status ⋮ Active: active (running) since Fri 2023-05-05 13:39:17 EEST; 7min ago ⋮
If the server does not seem to be running properly, you can start it manually:
# service apache2 restart
If needed, the server can be stopped by replacing restart with stop in the command above. Note, that when you have made changes to apache2 configuration you may issue command service apache2 reload for them to take effect without having to restart the service.
# ss -tap | grep apache2 LISTEN 0 511 *:http *:* users:(("apache2",pid=77777 ,fd=4), ("apache2",pid=77776 ,fd=4), ("apache2",pid=77775 ,fd=4))
# hostname -I 192.168.1.125 192.168.1.105
In my example I got the IP addresses of the WLAN and Ethernet ports of my laptop into which I installed Apache web server.
Open a browser either on the same computer on which you installed the server, or another computer in the same subnet. Type in one of the IP addresses you got in response to the hostname -I command. The default Apache2 page should show up:
# wget https://repo.zabbix.com/zabbix/6.4 /ubuntu/pool/main/z/... ... zabbix-release/zabbix-release_6.4-1 +ubuntu22.04_all.deb # dpkg -i zabbix-release_6.4-1 +ubuntu22.04_all.deb
To install the latest version, update the repositories first:
# apt update ⋮ All packages are up to date.
# apt install zabbix-server-mysql ␣ zabbix-frontend-php ␣ zabbix-apache-conf ␣... ... zabbix-sql-scripts ␣ zabbix-agent ⋮ Setting up zabbix-apache-conf (1:6.4.2-1 +ubuntu22.04) ... Enabling conf zabbix. To activate the new configuration, you need to run: systemctl reload apache2 ⋮
# systemctl reload apache2
Check that the database server is up and running:
# service mysql status ⋮Active: active (running) since Mon 2023-05-15 10:01:37 EEST; 5h 12min ago Main PID: 877 (mysqld) Status: "Server is operational" ⋮
Run the following command on a terminal of your database host, followed by MySQL commands shown below. Create a new zabbix database user password and store it in a safe place.
# mysql -uroot -pEnter password: root-password-for-mysql mysql> create database zabbix character set utf8mb4 collate utf8mb4_bin;Query OK, 1 row affected (0,02 sec) mysql> create user zabbix@localhost identified by 'zabbix-database-user-password';Query OK, 0 rows affected (0,11 sec) mysql> grant all privileges on zabbix.* to zabbix@localhost;Query OK, 0 rows affected (0,02 sec) mysql> set global log_bin_trust_function_creators = 1;Query OK, 0 rows affected (0,01 sec) mysql> flush privileges;Query OK, 0 rows affected (0,02 sec) mysql> quit;Bye
On Zabbix server host import, initial schema and data. Type in the following command on a single line. You will be prompted to enter your newly created password.
This will take several minutes.
# zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz |... ... mysql --default-character-set=utf8mb4 -uzabbix -p zabbixEnter password: zabbix-database-user-password
Disable log_bin_trust_function_creators option after importing database schema.
# mysql -uroot -pEnter password: root-password-for-mysql mysql> set global log_bin_trust_function_creators = 0;Query OK, 0 rows affected (0,00 sec) mysql> quit;
Edit file /etc/zabbix/zabbix_server.conf:
# nano /etc/zabbix/zabbix_server.conf
Find the line containing the parameter DBPassword and change it as shown below. Remember to remove # at the beginning of the line!
DBPassword=zabbix-database-user-password
Start Zabbix server, agent and web server processes and make them start at system boot.
# systemctl restart zabbix-server zabbix-agent apache2 # systemctl enable zabbix-server zabbix-agent apache2Synchronizing 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.
Create the Zabbix configuration file using your Zabbix server's web user interface at address https://your.server.addr/zabbix. All the major browsers are supported.
Create configuration file filling in the fields. Download file zabbix.conf.php and save it to Zabbix directory /etc/zabbix/. In the same directory there is already a file called zabbix_server.conf. Do not edit this file.
Restart Zabbix with command
# systemctl restart zabbix-server
you can find Zabbix log file zabbix_server.log in /var/log/zabbix-server. You can monitor the log with
# cd /var/log/zabbix-server # tail -f zabbix_server.log 3741187:20230411:212917.295 server #28 started [alerter #2] 3741188:20230411:212917.296 server #29 started [alerter #3] 3741193:20230411:212917.302 server #30 started [preprocessing manager #1] 3741198:20230411:212917.302 server #35 started [lld worker #1] 3741197:20230411:212917.303 server #34 started [lld manager #1] 3741199:20230411:212917.303 server #36 started [lld worker #2] 3741200:20230411:212917.304 server #37 started [alert syncer #1] 3741195:20230411:212917.402 server #32 started [preprocessing worker #2] 3741196:20230411:212917.402 server #33 started [preprocessing worker #3] 3741194:20230411:212917.403 server #31 started [preprocessing worker #1]
Quit the command by pressing ctrl-C.
Go to Zabbix dashboard at https://your.server.addr/zabbix.
# apt install zabbix-agent