Zabbix server on Ubuntu 18.04

Get network interface up and running

sudo nano /etc/netplan/01-netcfg.yaml
sudo netplan apply

Zabbix repository

wget https://repo.zabbix.com/zabbix/3.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.4-1+bionic_all.deb 
sudo dpkg -i zabbix-release_3.4-1+bionic_all.deb
wget http://repo.zabbix.com/zabbix/3.5/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.5-1%2Bbionic_all.deb
sudo dpkg -i zabbix-release_3.5-1+bionic_all.deb

Required software

sudo apt update && sudo apt-get upgrade
sudo apt install apache2 mysql-server
sudo apt install php php7.2-cli php7.2-mysql php7.2-common php7.2-curl php7.2-json php7.2-cgi libapache2-mod-php7.2 php7.2
sudo apt install php-gd php-xml php-ldap php-mysql
sudo apt install zabbix-server-mysql zabbix-frontend-php zabbix-agent

Set root password
e.g
Zabbix DBName=zabbix
Zabbix DBUser=zabbixuser
Zabbix DBPassword=password

sudo mysql -u root -p
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbixuser@localhost identified by 'password';
mysql> quit;

Import the initial schema

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

Change Timezone

sudo nano /etc/zabbix/apache.conf
e.g
php_value date.timezone Asia/Singapore

Change Timezone in php

sudo nano /etc/php/PHP_VERSION/apache2/php.ini

e.g.
date.timezone = 'Asia/Singapore'

Change zabbix config

sudo nano /etc/zabbix/zabbix_server.conf

e.g

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

Restart required services to browse to http://localhost/zabbix/ (default id/password: Admin/zabbix)

sudo systemctl enable zabbix-server zabbix-agent apache2

Auto start zabbix after reboot

sudo systemctl enable zabbix-server zabbix-agent apache2

 

Troubleshooting

Check installed
sudo apt list --installed

Main Repos
deb http://us.archive.ubuntu.com/ubuntu/ bionic main universe 
deb-src http://us.archive.ubuntu.com/ubuntu/ bionic main universe

Update Repos
deb http://us.archive.ubuntu.com/ubuntu/ bionic-security main universe
deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates main universe
deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-security main universe
deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-updates main universe

sudo apt-get clean 
sudo dpkg --configure -a 
sudo apt-get -f install 
sudo apt-get update

#Remove all custom repositories
sudo rm /etc/apt/sources.list.d/*

# Restart
sudo service zabbix-server restart
sudo service apache2 restart

Timezone change

sudo dpkg-reconfigure tzdata

Change time in frontend

sudo nano /etc/apache2/conf-enabled/zabbix.conf

<IfModule mod_php5.c>
    ..
    php_value max_execution_time 300
    php_value date.timezone Asia/Singapore
    ..
</IfModule>

Firewall

For Server: TCP Port: 10051
For Agent: TCP Port: 10050

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top