We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

Learn how to – How To Install Zabbix Server on Ubuntu 20.04|18.04

Learn how to – How To Install Zabbix Server on Ubuntu 20.04|18.04.

This guide aims at helping you to Install Zabbix Server on Ubuntu 20.04|18.04 Linux server. Zabbix is an enterprise-grade open source monitoring tool designed to monitor and track applications, systems, and Network devices status. The core of the Zabbix server is written in Java and C, with the frontend interface written in PHP.

Zabbix architecture uses the Server/Client model. The server communicates to the native software agents available for various Operating systems like Linux, NIX, and Windows. For systems without an agent, generic monitoring protocols such as Simple Network Management Protocol (SNMP) or Intelligent Platform Management Interface (IPMI) can be used.

Install Zabbix Server on Ubuntu 20.04|18.04

Installation of Zabbix has a number of steps and Prerequisites that we need to fulfill first. Among the dependencies required are:

  • Apache httpd web service
  • PHP
  • MySQL/ MariaDB database server

MySQL or MariaDB can be a remote server, but php and httpd need to be installed on the Zabbix server. Follow steps below to have Zabbix server installed and working on your Ubuntu system.

Step 1: Install and Configure Apache httpd server

Upgrade system:

sudo apt update && sudo apt -y full-upgrade

Reboot system:

sudo reboot

Install apache2 package using the apt-get command:

sudo apt update
sudo apt install apache2

After installing Apache, configure basic security by allowing Prod ServerTokens only.

sudo vim /etc/apache2/conf-enabled/security.conf

Change line 26

ServerTokens Prod

This directive configures what you return as the Server HTTP response. Valid options are Full | OS | Minimal | Minor | Major | Prod.

Set ServerName:

$ sudo vim /etc/apache2/apache2.conf
ServerName zabbix.example.com

Set Server Admin to receive an email in case of issues.

$ sudo vim /etc/apache2/apache2.conf
ServerAdmin admin@example.com

You need to restart apache web service after making these changes:

sudo systemctl restart apache2

If you have UFW firewall service running add http|https

$ sudo ufw allow http
Rule added
Rule added (v6

$ sudo ufw allow https
Rule added
Rule added (v6)

Step 2: Install PHP and required modules

Install all required PHP extensions using the commands below.

sudo apt install php php-cgi php-common libapache2-mod-php php-mbstring php-net-socket php-gd php-xml-util php-mysql php-bcmath

This will install php v7.x on Ubuntu , you can confirm using the command php -v

$ php -v
PHP 7.4.3 (cli) (built: Oct  6 2020 15:47:56) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies

Configure Apache:

sudo  a2enconf php7.*-cgi

Ensure you set correct timezone:

$ sudo vim /etc/php/*/apache2/php.ini 
; http://php.net/date.timezone
date.timezone = "Africa/Nairobi"

Restart apache2 after this change:

sudo systemctl restart apache2

Step 3: Install MariaDB Database Server

Run the commands below to install MariaDB database server:

sudo apt update
sudo apt install mariadb-server

Once Database server installation is done open MySQL terminal

$ sudo mysql -u root
Welcome to the MariaDB monitor. Commands end with ; or g.
Your MariaDB connection id is 56
Server version: 10.3.7-MariaDB-1:10.3.7+maria~bionic-log mariadb.org binary distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

Create a database and user for Zabbix:

CREATE DATABASE zabbix character set utf8 collate utf8_bin;;
GRANT ALL PRIVILEGES ON zabbix.* TO zabbix@'localhost' IDENTIFIED BY 'StronDBPassw0rd';
FLUSH PRIVILEGES; 
QUIT 

Step 4: Install Zabbix Server on Ubuntu

We need to add Zabbix repositories to get the latest release of Zabbix Server installed on Ubuntu 20.04|18.04:

Ubuntu 20.04:

wget https://repo.zabbix.com/zabbix/6.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.0-4+ubuntu20.04_all.deb
sudo apt install ./zabbix-release_6.0-4+ubuntu20.04_all.deb

Ubuntu 18.04:

wget https://repo.zabbix.com/zabbix/6.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.0-4+ubuntu18.04_all.deb
sudo apt install ./zabbix-release_6.0-4+ubuntu18.04_all.deb

Do system update and install Zabbix server packages

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

This can also be used to upgrade the Zabbix server. To check the installed version, use:

$ apt-cache policy zabbix-server-mysql
zabbix-server-mysql:
  Installed: 1:6.0.16-1+ubuntu20.04
  Candidate: 1:6.0.16-1+ubuntu20.04
  Version table:
 *** 1:6.0.16-1+ubuntu20.04 500
        500 https://repo.zabbix.com/zabbix/6.0/ubuntu focal/main amd64 Packages
        100 /var/lib/dpkg/status
     1:4.0.17+dfsg-1 500
        500 https://mirror.hetzner.com/ubuntu/packages focal/universe amd64 Packages

Import database data using the command:

sudo su -
zcat /usr/share/doc/zabbix-proxy-mysql/schema.sql.gz | mysql -uzabbix -p 'StronDBPassw0rd'

Step 5: Configure and Start Zabbix Server

Zabbix configuration file is located under  /etc/zabbix/zabbix_server.conf. Ensure the following lines are configured correctly.

DBName=zabbix
DBUser=zabbix
DBPassword=StronDBPassw0rd

Restart Zabbix server after modifying this file:

sudo systemctl restart zabbix-server

Edit /etc/php/*/apache2/php.ini to set php requirements for Zabbix server.

$ sudo vim /etc/php/*/apache2/php.ini
max_execution_time = 300
max_input_time = 300
post_max_size = 16M

Configure Zabbix agent to monitor Zabbix server itself.

$ sudo vim /etc/zabbix/zabbix_agentd.conf
Hostname=zabbix-server.ownyourlife.com.ng

Start and enable Zabbix Server:

sudo systemctl restart zabbix-server zabbix-agent apache2
sudo systemctl enable zabbix-server zabbix-agent apache

Configure Firewall

If you have ufw firewall installed and running on your system, ensure you allow port 5000 and port 5001

sudo ufw allow proto tcp from any to any port 10050,10051

Step 6: Perform Zabbix initial setup

Access “http://(Zabbix server’s hostname or IP address)/zabbix/”  to begin Zabbix initial setup.

Step 1 is a welcome page, click “Next step” to proceed.

Confirm that all pre-requisites are satisfied.

Configure DB settings as added before:

Confirm Hostname and Port number for Zabbix server. It is okay to use localhost in place of name.

Verify all settings and click Next step to finish the initial setup.

If all goes well, you should get congratulations page. Click the Finish button to end installation.

You’ll then get the login page. Default logins are:

Username: "admin"
Password: "zabbix"

Default dashboard page is as below:

Step 7: Change Admin Password

Login to Zabbix admin dashboard with admin user and password zabbix. You need to change the password for admin user after the first login for security reasons.

Navigate to Administration > Users > Admin > Password > Change Password

Enter the new password twice then click on the Update button to change.

Step 8: Configure Monitoring Target host

Now that we have our Zabbix server ready for monitoring, let’s configure first monitoring target host – This is Zabbix server monitoring itself.

Login to Zabbix admin dashboard with the username admin and click on Configuration > Hosts. You should have seen that the host localhost status is set to “Disabled”.

Click on the disabled button to enabled Zabbix agent on this server to monitor the host.  The “Status” is turned to “enabled” and the server is now being monitored.

After few minutes, monitoring data will start flowing in, to check host graphs go to Monitoring > Screens > Server name

In our next article, we’ll look at how to monitor Linux and Windows systems with Zabbix.

For Installation of Zabbix agent, look at

Cart

Your Cart is Empty

Back To Shop