Welcome to our guide on how to install Zabbix Server 5.0 on Ubuntu 18.04 & Ubuntu 16.04 LTS. Our previous guide was on the installation of Zabbix 4.0 on Ubuntu 18.04 server, so this guide is fit for you if doing an upgrade.

Zabbix is an enterprise-grade open source monitoring tool used for monitoring applications, systems, Network devices, IoT devices, e.t.c. Zabbix server backend is written in C and Java, and the frontend interface written in PHP.

For Ubuntu 20.04: How To Install Zabbix Server on Ubuntu 20.04

Zabbix Architecture

Zabbix works in a Client/Server 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 5.0 on Ubuntu 18.04 & Ubuntu 16.04 LTS

Here we will cover the steps to install Zabbix 5.0 on both Ubuntu 18.04 and Ubuntu 16.04 LTS. Follow them in order to avoid any issues that often result from missing something.

Zabbix Server depends on the following software applications:

  • Apache web server
  • PHP with required extensions
  • MySQL/ MariaDB database server

MySQL or MariaDB can be a remote server, but php and httpd need to be installed on the Zabbix server. It is possible to run Apache web server in reverse proxy mode.

Step 1: Install Apache httpd server

Update your system then install the apache2 package by running the following commands:

sudo apt update
sudo apt -y upgrade
sudo apt install -y apache2

After installing Apache, configure basic security by allowing Prod ServerTokens only on /etc/apache2/conf-enabled/security.conf

sudo sed -i "s/^ServerTokens OS$/ServerTokens Prod/" /etc/apache2/conf-enabled/security.conf
sudo sed -i "s/^ServerSignature On$/ServerSignature Off/" /etc/apache2/conf-enabled/security.conf

The directiveServerTokens configures what is returned 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 [email protected]

Restart Apache web service after making the changes:

sudo systemctl restart apache2

If  you have UFW firewall installed and enabled, allow access to port 443 and 80:

sudo ufw allow proto tcp from any to any port 80,443

To enable UFW firewall on Ubuntu, use:

sudo ufw enable

Don’t forget to enable ssh service:

sudo ufw allow ssh

Step 2: Install MariaDB Database server

Install MariaDB database server on Ubuntu 18.04 / Ubuntu 16.04 LTS using our guide, the link is shared below:

sudo apt install mariadb-server

Secure Database server:

sudo mysql_secure_installation

Update authentication plugin for root user.

$ sudo mysql -u root
UPDATE mysql.user SET plugin = 'mysql_native_password' WHERE User = 'root';

Once Database server installation is done, you need to create a database for Zabbix user:

export zabbix_db_pass="StrongPassword"
mysql -uroot -p <<MYSQL_SCRIPT
    create database zabbix character set utf8 collate utf8_bin;
    grant all privileges on zabbix.* to [email protected]'localhost' identified by '${zabbix_db_pass}';

Replace “StrongPassword” with your desired password for the database.

Step 3: Install Zabbix 5.0 Server on Ubuntu 18.04/16.04

Now that we have required dependencies installed and working, we can finalize our installation by deploying Zabbix 5.0 server.

Add Zabbix 5.0 repository on Ubuntu 18.04 (Bionic Beaver) LTS:

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

Add Zabbix 5.0 repository on Ubuntu 16.04 (Xenial Xerus) LTS:

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

Now install Zabbix 5.0 Server and frontend with MySQL support:

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

Accept packages installation:

The following NEW packages will be installed:
  fontconfig-config fonts-dejavu-core fping libaio1 libapache2-mod-php
  libapache2-mod-php7.2 libevent-2.1-6 libfontconfig1 libgd3 libjbig0
  libjpeg-turbo8 libjpeg8 libltdl7 libmysqlclient20 libodbc1 libopenipmi0
  libsensors4 libsnmp-base libsnmp30 libsodium23 libssh2-1 libtiff5
  libwebp6 libx11-6 libx11-data libxau6 libxcb1 libxdmcp6 libxpm4
  libxslt1.1 mysql-client mysql-client-5.7 mysql-client-core-5.7
  mysql-common php-bcmath php-common php-gd php-ldap php-mbstring
  php-mysql php-xml php7.2-bcmath php7.2-cli php7.2-common php7.2-gd
  php7.2-json php7.2-ldap php7.2-mbstring php7.2-mysql php7.2-opcache
  php7.2-readline php7.2-xml ttf-dejavu-core zabbix-agent
  zabbix-apache-conf zabbix-frontend-php zabbix-server-mysql
0 upgraded, 57 newly installed, 0 to remove and 0 not upgraded.
Need to get 23.8 MB of archives.
After this operation, 129 MB of additional disk space will be used.
Do you want to continue? [Y/n] y

Substitute ‘mysql’ in the commands with ‘pgsql‘ to use PostgreSQL, or with ‘sqlite3‘ to use SQLite3 (proxy only).

Import Zabbix Server database schema

For Zabbix server and Zabbix proxy daemons, a database is required. It is not needed to run Zabbix agent. If Zabbix server and proxy are installed on the same host, their databases must be created with different names!

Import initial schema and data for the server with MySQL:

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

Enter your Zabbix database user password when prompted.

With PostgreSQL:

zcat /usr/share/doc/zabbix-server-pgsql/create.sql.gz | sudo -u <username> psql zabbix

Step 4: Configure and start Zabbix server

Edit your Zabbix configuration file  /etc/zabbix/zabbix_server.conf and set database connection settings.

$ sudo vim /etc/zabbix/zabbix_server.conf

Restart Zabbix server after modifying this file:

sudo systemctl restart zabbix-server zabbix-agent apache2
sudo systemctl enable zabbix-server zabbix-agent apache2
Configure PHP for Zabbix frontend

Edit file /etc/zabbix/apache.conf, uncomment and set the right timezone for you.

$ sudo vim /etc/zabbix/apache.conf
php_value date.timezone Africa/Nairobi

Configure Zabbix agent to monitor Zabbix server itself.

$ sudo vim /etc/zabbix/zabbix_agentd.conf

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

Restart apache2 and start frontend installation:

sudo systemctl restart apache2

Step 5: 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.

zabbix 5 web 1

Confirm that all pre-requisites are satisfied.

zabbix setup 02

Configure DB settings

zabbix setup 03

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

zabbix setup 04

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.

zabbix setup 06

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

Username: "Admin"
Password: "zabbix"

Dashboard for Zabbix server 4.0 looks like below

zabbix 4 dashboard min

Step 6: 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

Configure Monitoring Target host

Now that we have our Zabbix server ready for monitoring, you can start configuring first monitoring target host. By default, Zabbix server is added to monitoring.

zabbix server screen min

To add other host devices, login to Zabbix admin dashboard with the username admin and click on Configuration > Hosts. 

After a few minutes, monitoring data will start flowing in, to check host graphs go to Monitoring > Screens > Server name. My next article will cover installation of Zabbix agent 4.0 on Ubuntu 18.04 and Ubuntu 16.04 LTS servers.

Your support is our everlasting motivation,
that cup of coffee is what keeps us going!

As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.


Please enter your comment!
Please enter your name here