ZABBIX SERVER Installation on ubuntu 20.04

What is Zabbix?


Zabbix is an open source monitoring software tool for different IT parts, including networks, servers, virtual machines (VMs) and cloud administrations.

What does Zabbix agent does?


A local Zabbix agent, created in C language, may run on different Operation Systems, including Linux, UNIX and Windows, and gather information like CPU, memory, disk and organization interface utilization from a gadget.

Primary highlights of Zabbix are:

  • Representation.
  • Easy arrangements.
  • Metric assortment.
  • Notice and remediation.
  • Issue recognition.
  • Appropriated observing.
  • Zabbix API.
  • Security and verification.

Prerequirement:

1 2 Fresh Installation's of Ubuntu20.04 Server

2 Apache server

3 Mysql/MariaDB/PostgreSql

4 Php(V7.2 or higher)

Above 2,3,4 are also known as LAMP Services


Step 1: Update and Upgrade the Repositories


sudo apt update && sudo apt upgrade -y


Step 2: Enable Root Login


sudo sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config


sudo systemctl restart ssh


sudo passwd


Then ssh into system/VM as root i.e “ssh root@ip-addr”


Step 3: Install Apache Server


apt install apache2 libapache2-mod-php


Step 4: Install Mysql Server


apt install mysql-server


Step 5: Install Php


apt install php php-mbstring php-gd php-xml php-bcmath php-ldap php-mysql


nano /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'


Step 6: Download Zabbix Deb file and install 


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


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


apt update


Step 7: Install Zabbix Server


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


systemctl reload apache2


Step 8: Create Zabbix database


mysql -u root -p


CREATE DATABASE zabbixdb character set utf8 collate utf8_bin;

CREATE USER 'zabbix'@’localhost’ IDENTIFIED BY ‘password’;

Or


CREATE USER 'zabbix'@localhost IDENTIFIED BY 'password';


GRANT ALL PRIVILEGES ON zabbixdb.* TO 'zabbix'@'localhost' WITH GRANT OPTION;

FLUSH PRIVILEGES;


Note: If error occur while creating user then use this commands

drop user zabbix@localhost;

flush privileges;

After this commands executed try to create zabbix user.


Step 9: Load the default schema of Zabbix of database .


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

Note : Ask’s for password , then enter the password given to user while creating database


Step 10: Update the zabbix configuration

nano /etc/zabbix/zabbix_server.conf

DBHost=localhost

DBName=zabbixdb

DBUser=zabbix

DBPassword=password


Enable the Zabbix serivce to start on system boot and restart service to reload new settings.


systemctl enable zabbix-server

systemctl restart zabbix-server


Then,restart Apache service.


systemctl restart apache2



Step 11: Running the Zabbix Web-Installer(i.e. ip-addr/zabbix)




Click on Next step Button

Check for pre-requirement 

Make sure all the requirements are fulfill by the server. Then click on the Next step button


Configure DB Configure

Provide your database credentials created in above steps and click on the Next step button




Note: If an error prompt like this  <<Unable to determine current Zabbix database version: the table "dbversion" was not found.>> Use this command to resolve


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


Zabbix Server Details



Pre-Installation Summary
Check the details and click on the Next Step


Installation Completed



Enter Username/Password


Use below credentials to login: Username: Admin Password: zabbix


Zabbix DashBoard

After Successful login, you will see the Zabbix Dashboard as provided.




Zabbix Client Installation/Configuration


Step 1: Update and Upgrade the Repositories


sudo apt update && sudo apt upgrade -y


Step 2: Enable Root Login


sudo sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config


sudo systemctl restart ssh


sudo passwd


Then ssh into system/VM as root i.e “ssh root@ip-addr”


Step 3: Add Zabbix Repositories and install


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

apt install ./zabbix-release_5.0-1+focal_all.deb


Step 4: Install and Configure Zabbix Agent


apt update


apt install zabbix-agent


Step 5: Edit Zabbix agent configuration in /etc/zabbix/zabbix_agentd.conf file.


nano /etc/zabbix/zabbix_agentd.conf


#Specify Zabbix server IP Address

Server=<server_ip>

#Specify Zabbix server ( For active checks)

ServerActive=<server_ip>

# Set this server hostname reported by Zabbix agent

Hostname=<client_hostname>



Restart and enable zabbix-agent after making the change:


systemctl enable zabbix-agent


systemctl restart zabbix-agent



Step 6: Add host to Zabbix Server


Login to admin Zabbix server interface, then go to Configuration > Hosts > Create host

Add the following information:

  • Host name of the server to be monitored
  • Visible name for the server to be monitored.
  • Select the group or add a new group for “Groups” field.
  • IP address
  • Zabbix agent service port -default is 10050
Configuration-Hosts-Create Host

After that, go to Templates

  • Click the select button and Link new templates section. Select the templates needed
  • Click on the Add link to link templates to your target system After the templates are linked, they’ll appear on under Linked templates section
Templates
Then click on ADD button. After few Minutes the zabbix client will be added to server and data will be collected and visualised using zabbix graphs.



Therefore the Installation of Zabbix Is Completed on Ubuntu 20.04