How to Install Zabbix Server on Ubuntu 18.04 & 16.04 LTS

Zabbix is a Free and Open-source enterprise-class monitoring software for servers, networks, and services. Zabbix offers a lot of reporting and data visualization features based on the stored data. This tutorial describes how to install Zabbix 4.0 LTS on Ubuntu 18.04 & 16.04 LTS systems.

zabbix-4.0-lts-on-ubuntu

Zabbix can be used for agent-based and agent-less monitoring. The Zabbix agent is available for various platforms like Linux, UNIX, macOS, and Windows. Zabbix created by Alexei Vladishev and released under GPL V2 License.

Prerequisites

  • To follow this tutorial, most importantly you need to log in as a user with Sudo privileges.

Installing Zabbix 4.0 LTS Server

Step 1 – Install Apache, MySQL, and PHP

Zabbix required the LAMP environment. Use the following command to install all the required components.

Run the below commands to update the package list and upgrade existing packages.

sudo apt-get update
sudo apt-get upgrade

Install Apache using the below command.

sudo apt-get install apache2 libapache2-mod-php

After that, install the MySql server using the below command.

sudo apt-get install mysql-server

Now, install the PHP and its extensions by running the below command.

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

Note: For Ubuntu 18.04 LTS it’s necessary to edit the file /etc/apt/sources.list for required PHP packages. Edit the file and make it look like this:

deb http://archive.ubuntu.com/ubuntu bionic main multiverse restricted universe
deb http://archive.ubuntu.com/ubuntu bionic-security main multiverse restricted universe
deb http://archive.ubuntu.com/ubuntu bionic-updates main multiverse restricted universe

Step 2 – Add Zabbix repository

Zabbix Server and Client packages not available in Ubuntu’s default repository. So, download and add the Zabbix repository by using the below command.

## Ubuntu 18.04 LTS (Bionic Beaver):
wget https://repo.zabbix.com/zabbix/4.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_4.0-3+bionic_all.deb
dpkg -i zabbix-release_4.0-3+bionic_all.deb
apt update

## Ubuntu 16.04 LTS (Xenial Xerus):
wget https://repo.zabbix.com/zabbix/4.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_4.0-3+xenial_all.deb
dpkg -i zabbix-release_4.0-3+xenial_all.deb
apt update

Step 3 – Install Zabbix on Ubuntu 18

Zabbix Software mainly required these three components Zabbix Server, Zabbix Web Frontend and Zabbix Agent. So, install all of them by running the below command.

apt -y install zabbix-server-mysql zabbix-frontend-php zabbix-agent

Step 4 – Setup MySQL Database

Login to your MySQL server and create a database and a new database user for Zabbix Server. So, create them by running the below command.

mysql -uroot -p

Enter the password for login.

create database zabbix_db character set utf8 collate utf8_bin;
grant all privileges on zabbix_db.* to zabbix@localhost identified by 'password';
quit;

After that, import the database schema by using the below command. During this process, you will be asked to enter the password of our new DB user.

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

Step 5 – Edit Zabbix Configuration File

After that, edit the configuration file located in /etc/zabbix/zabbix_server.conf and add the following information.

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

Step 5 – Edit PHP Configuration for Zabbix

Now, edit the file located at /etc/zabbix/apache.conf and uncomment and set the following values of PHP.

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 always_populate_raw_post_data -1
php_value date.timezone Asia/Kolkata

Make sure you set the right TimeZone.

Step 6 – Enable and Restart Zabbix and Apache Services

After that, Enable the Service of Zabbix Server and Apache Server

systemctl enable zabbix-server
systemctl enable zabbix-agent
systemctl enable apache2

Restart the Services by running the below command.

systemctl restart zabbix-server
systemctl restart zabbix-agent
systemctl restart apache2

Configure Zabbix frontend using Web Installer Wizzard

After that, point your browser to the below URL and remember to replace the “demo.linuxbots.com” with your domain name.

http://demo.linuxbots.com/zabbix

Now, Click on Next Step.

zabbix-installer-welcome-page
Zabbix Web installer welcome page

After that, make sure that all the required components are installed. Then click on Next Step.

zabbix-installer-check-dependancy
Zabbix Installer Check Dependancy

Now, Enter the Database details and click on Next Step.

zabbix-installer-db-connection
Zabbix Installer DB Connection

After that, Enter the name for the server and click on the Next step.

zabbix-installer-server-details
Zabbix Installer Server Details

On the summary page, you can verify the details provided in the previous steps. After verifying click on the Next step.

zabbix-installer-installation-summary
Zabbix Installer Summary Page

At the final step, click on the Finish button.

zabbix-installer-finish-page
Zabbix Installer Finish page

After that, you will be redirected to the login page. Here the default username is “Admin” and password is “zabbix“.

zabbix-login-page
Zabbix Login Page

After login, you will see the dashboard. Here we have successfully installed the Zabbix 4.0 LTS Server on Ubuntu 18.04 LTS Server.

zabbix-dashboard
Zabbix Dashboard

Conclusion:

In this tutorial, we installed Zabbix 4.0 Monitoring Server on Ubuntu 18.04 Server. You can share your views in the comment section.

Leave a Comment