How to Install Zabbix on Ubuntu 20.04

Install Zabbix on Ubuntu 20.04

In this article, we will have explained the necessary steps to install and configure Zabbix on Ubuntu 20.04 LTS. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

Zabbix is a free and open-source monitoring solution designed for real-time monitoring of servers, virtual machines, networks, and cloud services. It was developed by Alexei Vladishev and actively supported by Zabbix SIA. It is based on the client-server model and capable of monitoring millions of metrics, such as CPU load, network utilization, and disk space consumption from tens of thousands of servers.

Install Zabbix on Ubuntu 20.04

Step 1. First, before you start installing any package on your Ubuntu server, we always recommend making sure that all system packages are updated.

sudo apt update
sudo apt upgrade

Step 2. Install the LAMP stack on Ubuntu.

It is assumed that you have already installed the LAMP stack on the Ubuntu system. If not, please check out the following tutorial:

Step 3. Install Zabbix on the Ubuntu system.

Run the following commands to install Zabbix server packages:

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

Step 4. Create Zabbix Database and User

You need to create a database for Zabbix user:

$ mysql -u root -p
CREATE DATABASE zabbixdb;
GRANT ALL PRIVILEGES ON zabbix.* TO zabbix@'localhost' IDENTIFIED BY 'Your-Strong-Password';
FLUSH PRIVILEGES;
QUIT;

After creating the database, load the default schema of Zabbix of database:

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

Step 5. Configure Zabbix Server.

Now we edit the Zabbix configuration file /etc/zabbix/zabbix_server.conf and set the database name, user and password:

nano /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbixdb
DBUser=zabbix
DBPassword=your-strong-password

Next, enable the Zabbix serivce to start on system boot and restart service to reload new settings:

sudo systemctl enable zabbix-server
sudo systemctl restart zabbix-server

Step 6. Configure Firewall.

Configure the firewall to allow the Zabbix agent to reach the Zabbix server:

sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-port=10050/tcp
sudo firewall-cmd --permanent --add-port=10051/tcp
sudo firewall-cmd --reload

Step 7. Accessing Zabbix.

That’s it. It is time to use your favorite web browser and navigate to:

http://your-server-ip/zabbix

Install Zabbix on Ubuntu 20.04

That’s all you need to do to install Zabbix on Ubuntu 20.04 LTS Focal Fossa. I hope you find this quick tip helpful. For further reading on Zabbix, please refer to their official knowledge base. If you have questions or suggestions, feel free to leave a comment below.