Note that this guide assumes an "All in one" server setup, where the Zabbix Server and supporting database are all on one machine. It also asusmes Zabbix Proxy is not used, or will be setup later.
NOTE: content based on https://www.zabbix.com/documentation/4.0/manual/installation/install_from_packages/debian_ubuntu
For trouble shooting, review the Zabbix logs located at /var/log/zabbix/zabbix_server.log
Download Zabbix 4.0 setup file from their server:
wget https://repo.zabbix.com/zabbix/4.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_4.0-2+bionic_all.deb
Run the local package manager to install the setup tools:
sudo dpkg -i zabbix-release_4.0-2+bionic_all.deb
Some Zabbix components require packages only available in the universe repository. To enable this:
sudo add-apt-repositary universe
Run an update of the package repositories to pull in the new packages, then run any updates for the existing packages:
sudo apt update; sudo apt upgrade -y
Install Zabbix server with MySQL. Note that other suffixes can be added to change to other databases like SQLite3 and Postgres:
sudo apt install zabbix-server-mysql
Note that as a dependencies of the installation, Zabbix installs MariaDB, a drop-in replacement for MySQL (at the time of writing). Before doing anything else, it's important to create a zabbix database and setup permissions for a zabbix user. Open MariaDB/MySQL using the following command:
sudo mysql
You may be asked for the current Linux user's password.
Create a database for the zabbix user, making sure to force UTF8 as the character set:
create database zabbix character set utf8 collate utf8_bin;
Create a user for Zabbix with access to the database at localhost only, remembering to change the password for your own secure password:
grant all privileges on zabbix.* to zabbix@localhost identified by 'password';
exit mysql:
quit
Now you can import the database provided by the zabbix-server-mysql package:
zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql -uzabbix -p zabbix
It will ask for the Zabbix database password you entered in the MySQL client.
Edit the Zabbix server configuration file to set the database details:
sudo nano /etc/zabbix/zabbix_server.conf
The following lines need edited/added, remembering to remove any prefixing "#" as this donates a comment. Make sure your password is entered without quote marks:
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=password
Start the server by running the following command:
service zabbix-server start
Install the frontend for the server:
sudo apt install zabbix-frontend-php
For some reason, Zabbix needs time zones set for PHP in apache instead of pulling it from the server. Edit the apache configuration file for Zabbbix and set the time zones for PHP 7 (optionally PHP 5):
sudo nano /etc/apache2/conf-enabled/zabbix.conf
php_value date.timezone UTC
To avoid any timezone change clashes with data, it's suggested that UTC is used as the timezone.
Restart apache to enable the changes:
service apache2 restart
You should now be able to access the Zabbix installation wizard via a web browser.