If you are into server administration, you definitely need a good monitoring tool to monitor various things running on a server. I would suggest using Zabbix for this. I personally use it and, frankly speaking, it’s awesome.
What is Zabbix?
Zabbix is an open-source GUI-based tool to monitor almost everything running on your server. It offers enterprise-level monitoring features. You can use it to monitor server resources, networks, applications, services and many others. You can also configure notifications and alerts according to your needs.
In this tutorial, i will guide you to install Zabbix 8 with Nginx on Ubuntu 26.04.
Prerequisites
- A server with Ubuntu 26.04 installed
- A user with sudo privileges
Step 1 – Update the system
Before proceeding with the installation, Let’s first update our system
sudo apt update -y
sudo apt upgrade -y
Step 2 – Install, Secure and Configure MariaDB
We will use MariaDB as the database for this setup. Let’s first install MariaDB and then secure it.
sudo apt install mariadb-server -y
Now let’s secure our database
sudo mariadb-secure-installation
Enter current password for root (enter for none): (Just hit enter key)
Switch to unix_socket authentication [Y/n]: (Press N and hit enter key)
Change the root password? [Y/n]: (Press Y and hit enter key)
Enter New Password:
Confirm New Password:
Note: Make sure to enter a strong and memorable password here
Remove anonymous users? [Y/n]: (Press Y and hit enter key)
Disallow root login remotely? [Y/n]: (Press Y and hit enter key)
Remove test database and access? [Y/n]: (Press Y and hit enter key)
Reload privilege tables now? [Y/n]: (Press Y and hit enter key)
Now let’s configure our Database
sudo mysql -u root -p
CREATE DATABASE zabbix CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
CREATE USER zabbix@localhost IDENTIFIED BY 'Your_Strong_Password_Here';
GRANT ALL PRIVILEGES ON zabbix.* TO zabbix@localhost;
SET GLOBAL log_bin_trust_function_creators = 1;
QUIT;
Note:- Make sure to change "Your_Strong_Password_Here" to you the password you want to have for your database
Step 3 – Install PHP 8.5
Next Let’s install PHP 8.5 for our setup
sudo apt install php8.5-fpm php8.5-mysql php8.5-cli php8.5-common php8.5-curl php8.5-xml php8.5-mbstring php8.5-zip php8.5-gd php8.5-bcmath php8.5-sockets -y
Now update the php parameters in PHP.INI file
sudo nano /etc/php/8.5/fpm/php.ini
Update the parameters as below
memory_limit = 128M
post_max_size = 16M
upload_max_filesize = 2M
max_execution_time = 300
max_input_time = 300
save and exit
Now restart php8.5-fpm
sudo systemctl restart php8.5-fpm
Step 4 – Install and Configure Zabbix
Next we will download, install and configure Zabbix. To download execute the following
wget https://repo.zabbix.com/zabbix/8.0/release/ubuntu/pool/main/z/zabbix-release/zabbix-release_latest+ubuntu26.04_all.deb
Now let’s install the downloaded package
sudo dpkg -i zabbix-release_latest+ubuntu26.04_all.deb
Now, update the local package repository
sudo apt update -y
Now let’s install Zabbix frontend, Zabbix server and Agent
sudo apt install zabbix-server-mysql zabbix-frontend-php zabbix-nginx-conf zabbix-sql-scripts zabbix-agent2
Now Let’s import the Zabbix database schema
sudo zcat /usr/share/zabbix/sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix
When prompted, enter your database password that you have created in step 2
Now that the Zabbix database schema has been imported, disable “log_bin_trust_function_creators”.
sudo mysql -u root -p
SET GLOBAL log_bin_trust_function_creators = 0;
QUIT;
Now we will configure Zabbix server’s database. To do this, we will have to edit the Zabbix server configuration file
sudo nano /etc/zabbix/zabbix_server.conf
Now scroll and find “DBPassword” and update it with the database password you have created in Step 2
DBPassword=Your_Password_Here
Step 5 – Configure Nginx
Next let’s configure Nginx
sudo nano /etc/zabbix/nginx.conf
Uncomment the listen and server_name directive. Make sure it looks like this
listen 80;
server_name example.com;
Note: Change "example.com" to your real domain name
Step 6 – Updating the firewall rules
Let’s update the firewall to allow incoming requests from port 80 and 443 as we will setup SSL too.
sudo ufw allow OpenSSH
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw enable
sudo ufw reload
Step 7 – Securing with Let’s Encrypt SSL
Now, Let’s secure out setup with Let’s Encrypt SSL. To install and manage SSL certificate, we will use certbot. To add more security to your server, you can configure fail2ban and change SSH port.
sudo apt install certbot python3-certbot-nginx -y
Now let’s obtain and configure the SSL certificate.
sudo certbot --nginx -d example.com
Note: Make sure to change example.com with your real domain
Follow the interactive prompts and SSL certificates will be installed
Note:- Certbot will automatically update the Nginx configuration and configure HTTPS for your domain.
You can try a test renewal of SSL certificates by executing the command below
sudo certbot renew --dry-run
Step 8 – Restart and Enable the services
Now, let’s just restart the Zabbix server, Nginx and Php8.5-fpm
sudo nginx -t
sudo systemctl restart zabbix-server zabbix-agent2 nginx php8.5-fpm
sudo systemctl enable zabbix-server zabbix-agent2 nginx php8.5-fpm
Let’s check the status of all the services
sudo systemctl status zabbix-server zabbix-agent2 nginx php8.5-fpm
Step 9 – Finalize the setup from web interface
Now open any browser and enter your domain as below
https://example.com
Note: change example.com to your real domain.
Now enter the details as per the above steps in the web based setup.
Conclusion
With this we have configured Zabbix on Ubuntu 26.04 with SSL.
Frequently asked questions
Instead of MariaDB, can i use PostgreSQL?
Yes, you can absolutely use PostgreSQL, but database configurations will change.
Is Zabbix free to use?
Yes. Zabbix is free and open-source software. You can use the Zabbix server, web frontend, and agents without purchasing a commercial license.
Can Zabbix monitor Windows servers?
Yes. Zabbix Agent 2 can be installed on supported Windows systems, allowing Zabbix to monitor Windows servers in addition to Linux systems.