Technical Documentation On Zabbix

Prepared By Walid Al Habib

Step-by-Step Zabbix Installation on Ubuntu 22.04.4 LTS Server

1. Install Ubuntu 22.04.4 LTS Server (Jammy Jellyfish) on Your Machine

File Name: ubuntu-22.04.4-live-server-amd64.iso

Architecture: 64-bit (amd64)

Resources allocation:

  • 2 GB RAM (4 GB recommended for larger environments)
  • CPU 2 Core
  • 10 GB disk (20 GB+ recommended for long-term use)

Follow the on screen steps to complete the installation. Once the installation is completed, you’ll be prompted to set a username and password for your Ubuntu server.

2. Update Your System

The first step is to update your package list and upgrade the installed packages to the latest versions.

sudo apt update && sudo apt upgrade -y

This command does the following:

sudo apt update: Updates the package lists for upgrades and new package installations.

sudo apt upgrade -y: Upgrades all the installed packages on your system to the latest version.

Enable SSH:

sudo apt install openssh-server
sudo systemctl status ssh
sudo ufw allow ssh
          

3. Install Required Dependencies

sudo apt install -y wget gnupg lsb-release apt-transport-https

This installs:

wget: Command-line tool for downloading files from the web.

gnupg: Encryption software to ensure secure installations.

lsb-release: Provides information about the version of Ubuntu.

apt-transport-https: Allows APT to use repositories over HTTPS.

4. Add the Zabbix Repository

Now, add the Zabbix repository to your system so that you can install Zabbix from a trusted source.

wget https://repo.zabbix.com/zabbix/6.5/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.5-1+ubuntu22.04_all.deb

After downloading the .deb package for the Zabbix repository, install it:

sudo dpkg -i zabbix-release_6.5-1+ubuntu22.04_all.deb

Next, update your package list to include the Zabbix packages:

sudo apt update

5. Install Zabbix Server, Frontend, and Agent

sudo apt install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-sql-scripts zabbix-agent mariadb-server -y

This will install:

Zabbix server: The main Zabbix backend service.

Zabbix frontend: The web-based interface for interacting with Zabbix.

Zabbix agent: The monitoring agent installed on hosts.

MariaDB: The database system used to store Zabbix data.

6. Secure MariaDB

sudo mysql_secure_installation

This will prompt you for a root password (or leave it empty if you use socket authentication). Answer Y to the following questions:

  • Remove anonymous users
  • Disallow remote root login
  • Remove the test database
  • Reload privilege tables

7. Create Zabbix Database and User

sudo mysql -u root -p

Once logged into MariaDB, run the following SQL queries:

CREATE DATABASE zabbix CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
CREATE USER 'zabbix'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON zabbix.* TO 'zabbix'@'localhost';
FLUSH PRIVILEGES;
EXIT;
          

This creates a zabbix database and assigns a user zabbix with the necessary permissions.

8. Import Zabbix Schema

zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql -u zabbix -p zabbix

And enter your dbpassword. This command imports the necessary Zabbix database schema and tables into your zabbix database.

9. Configure Zabbix Server

sudo nano /etc/zabbix/zabbix_server.conf

Find the following line using Ctrl + W:

# DBPassword=

Uncomment the line (remove the #) and enter your database password:

DBPassword=your_zabbix_db_password

Save and exit the file by pressing Ctrl + O to save and Ctrl + X to exit.

10. Start and Enable Zabbix Services

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

11. Access Zabbix Web Interface

Open a web browser and visit:

http://<Server IP>/zabbix

Replace <Server IP> with the IP address of your Zabbix server.

Use command ip a to view your server IP.

12. Complete the Web Setup Wizard

  • DB host: localhost
  • DB name: zabbix
  • DB user: zabbix
  • DB password: your_zabbix_db_password
  • Zabbix server name: Set any name you like for your server.

Default login:

  • Username: Admin
  • Password: zabbix

13. Fix Timezone Issue (If Required)

timedatectl
sudo timedatectl set-timezone Asia/Dhaka
sudo nano /etc/php/8.1/apache2/php.ini

Set:

date.timezone = Asia/Dhaka
sudo systemctl restart apache2
sudo systemctl restart zabbix-server
          

14. Reload Zabbix Dashboard

Now everything should be running smoothly.

Prepared by - Walid Al Habib