How to Install Zabbix Server 5.0 on Ubuntu 20.04

Zabbix is completely free and open-source monitoring tool designed for real-time monitoring of servers, virtual machines, network devices, and cloud infrastructure. Zabbix was introduced by Alexei Vladishev and actively backed by Zabbix SIA. In this tutorial, you will learn How to Install Zabbix Server 5.0 on Ubuntu 20.04.

Zabbix uses the agent installed on remote hosts to collect the system metrics. Zabbix sends you real-time alert notification via SMS, E-mail, alert scripts, or webhook. Additionally, Zabbix supports host monitoring via SNMP, TCP, and ICMP checks, as well as over IPMI, JMX, SSH, and telnet.

Prerequisites

  • Ubuntu 20.04 server
  • User with root user or sudo privileges
  • 128MB of RAM (the amount of memory or disk depends on the number of hosts and parameters are being monitored)
  • 256MB of HDD space
  • Fast Internet Connection

Here we will use 2 GB RAM and 2 GB HDD in this tutorial. This configuration is sufficient to monitor 500 hosts.

Update Ubuntu Official Repository

Let’s update our local repository first.

$ sudo apt update

Setup & Configure LAMP

You need LAMP stack installed for Zabbix installation to function properly. Zabbix required PHP programming language to run, MySQL as Database Server and a Web Server like Apache or Nginx. We will use Apache web server in this tutorial.

$ sudo apt install apache2 libapache2-mod-php

$ sudo apt install mysql-server
$ sudo apt install php php-mbstring php-gd php-xml php-bcmath php-ldap php-mysql

Setup Database

Next, you need to set a strong password for the MySQL root user. Execute the below command and follow the instructions. After completing below command, you will have a password for the root account of MySQL database server.

$ sudo mysql_secure_installation

Setup PHP configuration

You update the PHP configuration variables. Edit the PHP configuration file /etc/php/7.4/apache2/php.ini for Apache and update timezone as per your requirements.

$ vim /etc/php/7.4/apache2/php.ini

memory_limit 256M
upload_max_filesize 16M
post_max_size 16M
max_execution_time 300
max_input_time 300
max_input_vars 10000
date.timezone = 'Asia/Kolkata'

Configuring Zabbix Repository

Zabbix official team provided Apt package repositories for the ubuntu. You need below commands to add the repository on your ubuntu system.

$ wget https://repo.zabbix.com/zabbix/5.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.0-1+focal_all.deb

$ sudo dpkg -i zabbix-release_5.0-1+focal_all.deb

Installing Zabbix Server

When you added the Apt repository, use below commands to install Zabbix server packages. Zabbix-server-mysql package includes MySQL support for Zabbix server. The zabbix-frontend-php package provides the web interface for Zabbix Server.

$ sudo apt update

$ sudo apt install zabbix-server-mysql zabbix-frontend-php zabbix-agent zabbix-apache-conf

Configure Zabbix Database and User

Now, create a database schema for the Zabbix server. Please login into MySQL Database Server with the root account and create MySQL database and user with the below commands.

$ mysql -u root -p

mysql> CREATE DATABASE zabbixdb character set utf8 collate utf8_bin;
mysql> CREATE USER 'zabbix'@'localhost' IDENTIFIED BY 'password';
mysql> GRANT ALL PRIVILEGES ON zabbixdb.* TO 'zabbix'@'localhost' WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;

After creating the database, load the default schema of Zabbix into database.

$ cd /usr/share/doc/zabbix-server-mysql
$ zcat create.sql.gz | mysql -u zabbix -p zabbixdb

Update Zabbix Configuration

Update zabbix server configuration file /etc/zabbix/zabbix_server.conf in your favorite editor and update the following database configurations. Zabbix server needs this to connect to the database.

$ sudo vi /etc/zabbix/zabbix_server.conf

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

Now, enable the Zabbix service to start at the time of system boot and restart service to reload new settings.

$ sudo systemctl enable zabbix-server

$ sudo systemctl restart zabbix-server

The Zabbix packages also creates its own Apache configuration file i.e. /etc/zabbix/apache.conf and it is linked to Apache configuration directory. So we need to restart the Apache service.

$ sudo systemctl restart apache2

Configure the Firewall for Zabbix Server

Next, you will need to open the Zabbix ports 10050 , 10051 and HTTP service in the firewall of server. You can allow them using following commands.

$ sudo ufw allow 10050/tcp
$ sudo ufw allow 10051/tcp
$ sudo ufw allow 80/tcp
$ sudo ufw status

Therefore, your system is ready for Zabbix installation. Let’s go to the Zabbix web installer and finish the installation.

Running the Zabbix Web Installer

You can access zabbix web installer on /zabbix subdirectory and URL on your servers IP or domain. Let’s access the Zabbix Web installer using the below URL.

http://Server_IP_Addr/zabbix/

Next, open a web browser and type the URL http://server_ip_addr/zabbix. This will open the Zabbix web installation wizard in the following screens.

Now click on the Next Step button. You would see the following page:

In above screen, make sure all the requirements are fulfilled. Then click on the Next Step button. You would see the following page.

In above screen, provide your database credentials. Then click on the Next Step button. You would see the following page.

in above screen, provide your details of zabbix server . Then click on the Next Step button. You would see the following page.

Next in above screen please make sure all the details are correct. Then proceed further with next step button.

Congratulations, you have done it. Click on Finish button.

You are good to login into Zabbix console. Please use below default credentials to login

Username: Admin
Password: zabbix

Finally, you are here in the zabbix dashboard.

Conclusion

Hence, in this tutorial you have learned how to Install Zabbix Server 5.0 on Ubuntu 20.04. In our next article you will learn how to add remote hosts in zabbix monitoring server. So stay tuned. I hope I helped.. Thanks!!!

Read Also : How to Setup and Configure Nagios Core on CentOS 7

Share on:

Ravindra Kumar

Hi, This is Ravindra. I am founder of TheCodeCloud. I am AWS Certified Solutions Architect Associate & Certified in Oracle Cloud as well. I am DevOps and Data Science Enthusiast.

Recommended Reading..

4 thoughts on “How to Install Zabbix Server 5.0 on Ubuntu 20.04”

Leave a Comment