Skip to content

Zabbix Server Install

Zabbix is an open-source monitoring tool that monitors IT infrastructure, including: Networks, Servers, Virtual machines (VMs), Cloud services, Applications, Databases, and Websites

In this episode we will cover how to setup the server side of Zabbix and in the followin episode/article we will show you the agent side.

Our Homelab Topology

Description of your image

The Order of Commands

Description of your image

List of commands used

If you do not care about the screenshots, here is a list of commands used!

Warning Box Example

Some commands MAY change usually just step 2 based on the current version of Zabbix. All other commands should work though.

Install zabbix Commands:

Link to Zabbix's site and the commands can be found here

sudo -s
wget https://repo.zabbix.com/zabbix/7.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_latest_7.0+ubuntu22.04_all.deb
dpkg -i zabbix-release_latest_7.0+ubuntu22.04_all.deb
apt update
apt install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-sql-scripts zabbix-agent

Install SQL server

installs mySQL

sudo apt-get install mysql-server
Starts mySQL on boot
sudo systemctl start mysql
start it
service mysql start
then do
mysql

Create the database

sudo mysql
Formats the database type to a the format Zabbix can understand (utf8mb4)
create database zabbix character set utf8mb4 collate utf8mb4_bin;
With this one the password section is where you assign your database password
create user zabbix@localhost identified by 'password';
Giving your user access to read and write to this database
grant all privileges on zabbix.* to zabbix@localhost;
Set trust for the database
set global log_bin_trust_function_creators = 1;
Exit mySQL
quit;

Warning Box Example

wait a couple minutes after doing the following command, the script takes awhile to work. You won't see any output for a couple minutes

zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix

Go back into mySQL

mysql

set global log_bin_trust_function_creators = 0;
quit;

then go into the following config file and update the section (DBPassword=) section with the password you set earlier. It will be under the Database user=Zabbix section.

nano /etc/zabbix/zabbix_server.conf

Start the services with the following commands:

systemctl restart zabbix-server zabbix-agent apache2

systemctl enable zabbix-server zabbix-agent apache2

Now you can go to your Zabbix servers URL with the following format:

http://host_machine_ip/zabbix

Walkthrough

Create a virutal machine for your Zabbix server. We used 2 cores, 2gb of RAM, and 20gb of storage on an Ubuntu Linux ISO 22.04 Jammy. Here is the ISO

Description of your image

First go to Zabbix's site and grab the current version of Zabbix you are downloading, this is very important specifically for step 2 as shown under the order of commands section. Go here

Description of your image

Now go ahead and login (SSH) to your freshly created VM for the Zabbix Server

Description of your image

Perform the following commands:


sudo -s
wget https://repo.zabbix.com/zabbix/7.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_latest_7.0+ubuntu22.04_all.deb
dpkg -i zabbix-release_latest_7.0+ubuntu22.04_all.deb
apt update
apt install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-sql-scripts zabbix-agent

Install SQL server


installs mySQL

sudo apt-get install mysql-server
Starts mySQL on boot
sudo systemctl start mysql
start it
service mysql start
then do
mysql

Create the mySQL database:


sudo mysql
Formats the database type to a the format Zabbix can understand (utf8mb4)
create database zabbix character set utf8mb4 collate utf8mb4_bin;
With this one the password section is where you assign your database password
create user zabbix@localhost identified by 'password';
Giving your user access to read and write to this database
grant all privileges on zabbix.* to zabbix@localhost;
Set trust for the database
set global log_bin_trust_function_creators = 1;
Exit mySQL
quit;


At this point we are going to execute the following command, you will notice no response after inputting the command and entering the password for the zabbix user you just created 7 command ago. That is normal, give the script a couple minutes to do its thing.

zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix

Description of your image

Now perform the following commands after the CLI comes back from being blank.

mysql
set global log_bin_trust_function_creators = 0;
quit;

We need to now edit the following config file, open it with:

nano /etc/zabbix/zabbix_server.conf

Description of your image

Look for the DBuser=zabbix section and edit the DBPassword= section with the password you just set earlier.

Description of your image

It will look like this when you are done. You can then save and exit with ctrl + X then click Y and lastly to save it click enter

Description of your image

Now perform the following commands to start the Zabbix server and all its needed counterparts.

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

Now go to your browser and we need to login with the following format:

http://host_machine_ip/zabbix

Description of your image

You will be presented with the following landing page, click next.

Description of your image

Make sure everything has a green ok so you know you did it right.

Description of your image

Ensure you add the database user password you just set in that config file so Zabbix's panel can access it.

Description of your image

Set your server name and timezone

Description of your image

ensure all settings have been filled out or go back and fix them

Description of your image

login, remember the login for username and password is case sensitive! it is Admin NOT admin.

User: Admin

Pass: zabbix

Description of your image

You are in, stay tuned for next episode on how to setup an agent on your servers, VMs, firewalls, etc!

Description of your image