Zabbix is one of the most popular open-source monitoring tools for networks and applications. It is designed to track and monitor the status of your system and servers. It provides tons of matric collected from the servers that help you to determine the status of current IT infrastructures. In this tutorial, I am going to show you a step-by-step guide to install Zabbix monitoring tool on Ubuntu 20.04. So let’s get started.
Minimum Server Requirements
- 128 MB RAM (Minimum)
- 256 MB Disk Space(Minimum)
- Ubuntu 20.04 Focal Fossa.
- A non-root user with sudo privilege
- LAMP installed on the server. Click here to install LAMP on Ubuntu 20.04
Recommended Server Specifications(Not Official)
- 4 GB RAM
- 4 Core CPU
- 50 GB disk space
Zabbix Install on Ubuntu 20.04 – Installation Steps
At the time of installation latest version of Zabbix is version 5.4. To run Zabbix you need Apache, MySQL, and PHP installed on the server. I assume, you already installed the LAMP stack on your Ubuntu server. If not, follow this LAMP installation guide for installation steps.
Now, let’s install Zabbix monitoring tool on Ubuntu 20.04 step-by-step.
Step 1: Install Zabbix Monitoring Tool on Ubuntu 20.04
First, login to the server. I am using AWS EC2 Ubuntu instance for the installation.
$ ssh -i Download/zabbix.pem [email protected]
Now, you have to options to download the zabbix on Ubuntu.
Option 1: You can install Zabbix Monitoring Tool on Ubuntu 20.04 from the ubuntu package manager. But this is not recommended as most of the outdated versions.
Option 2: Download the Zabbix from the official website. You can build Zabbix packages download links by choosing the Zabbix version, OS, OS version, database, and webserver.
Option 2 is recommended way to install Zabbix. Now copy the download link and run on command line.
$ wget https://repo.zabbix.com/zabbix/5.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.4-1+ubuntu20.04_all.deb
$ sudo dpkg -i zabbix-release_5.4-1+ubuntu20.04_all.deb
Output will be something like this
Selecting previously unselected package zabbix-release.
(Reading database ... 89746 files and directories currently installed.)
Preparing to unpack zabbix-release_5.4-1+ubuntu20.04_all.deb ...
Unpacking zabbix-release (1:5.4-1+ubuntu20.04) ...
Setting up zabbix-release (1:5.4-1+ubuntu20.04) ...
Now, update the package manager to install Zabbix packages
$ sudo apt update
After updating the Ubuntu package manager, now install Zabbix frontend, Zabbix agent and other packages by following command.
$ sudo apt install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-agent
Step 2: Create Database and Import Zabbix Database Scheme
Login to MySQL dashboard and create a database for Zabbix.
$ mysql -u root -p
mysql> CREATE DATABASE zabbix_db character set utf8 collate utf8_bin;
After creating database for the Zabbix, import Zabbix database scheme by following command.
zcat /usr/share/doc/zabbix-sql-scripts/mysql/create.sql.gz | mysql -uroot -p zabbix_db
Your Zabbix database scheme is successfully imported to zabbix_db
.
Now, in order to use the database with Zabbix server, you have to edit the Zabbix server configuration file.
$ sudo vi /etc/zabbix/zabbix_server.conf
Find the DBUser, DBName and DBpassword to change with your values.
DBName=zabbix
DBUser=root
DBPass=xxxxx
Step 3: Configuring PHP for Zabbix Frontend
The Zabbix Frontend is written in PHP and requires some special PHP server settings. During Zabbix installation an apache configuration file generated, you can find the file under the directory /etc/zabbix
. Open configuration file by the following command.
$ sudo vi /etc/zabbix/apache.conf
Output should look like
<IfModule mod_php7.c>
php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
php_value max_input_vars 10000
php_value always_populate_raw_post_data -1
# php_value date.timezone Europe/Riga
</IfModule>
Uncomment the time zone line and change it to your time zone.
Now, restart Apache server . Use following command to restart Apache.
$ sudo systemctl restart apache2
Start Zabbix server using following command.
$ sudo systemctl start zabbix-server
Check the Zabbix server status, to make sure it started.
$ sudo systemctl status zabbix-server
Output should look like
Finally, enable the server to start at boot time by following command.
$ sudo systemctl enable zabbix-server
Step 4: Install and Configure Zabbix Frontend
Open the Zabbix frontend installation page using your favorite browser such as chrome. The address will be your server IP/zabbix
.
18.116.41.244/zabbix
On the first screen, you will see a welcome message with the option to select the default language. Click Next step to continue. Now, the installer will show you the prerequisites of the server. Scroll down to check, if all the required values are set correctly or not, and then proceed to the next step.
Now, type the database details on this page and continue to next step.
After the database details setup, you will asked to enter host details.
You can keep the default GUI setting. On the next page it will show pre-installation summary. Now, click on next to finish the installation.
Congratulations, you have successfully installed Zabbix server. Your default user is Admin and the password is zabbix.
ERROR 1071 (42000) at line 258: Specified key was too long; max key length is 3072 bytes – How to fix?
You may encounter this error if you create a simple database without UTF-8 character support. Run the following command to create a database with UTF-8 character support.CREATE DATABASE database_name character set utf8 collate utf8_bin;
What is the default user and password for Zabbix server?
default user is Admin and the password is zabbix
Conclusion
In this tutorial, you have learned to install Zabbix monitoring tool on Ubuntu 20.04. If you have any doubts feel free to contact me, I will definitely try to help you. Also, you can join our elite Facebook group to get direct help from me. If you like this tutorial, please share this article on your social media handle.