Zabbix for Ubuntu 24.04 Server
Installs and configures the latest available Zabbix LTS release on Ubuntu 24.04 Server.
This is a production-focused installer, not a demo.
It assumes Nginx, PHP-FPM, and MariaDB are already installed and running.
Related Installers
If you don’t have the required components, you can use these compatible installers:
Download the Script
Clone this repository to your server:
git clone https://git.x-files.dk/network/zabbix-ubuntu.git
cd zabbix-ubuntu
Usage
Run the script using:
sudo ./zabbixinstall -n <domain> -p <zabbix db password> [options]
Examples
The installer automatically detects if socket authentication is active. Only include -a and -m if your MariaDB setup does not use socket authentication.
sudo ./zabbixinstall -n zabbix.example.com -p zabbixdbpwd
sudo ./zabbixinstall -n zabbix.example.com -p zabbixdbpwd -m rootpwd
sudo ./zabbixinstall -n zabbix.example.com -p zabbixdbpwd -a admin -m adminpwd
Options
| Flag | Description |
|---|---|
-p <password> |
Zabbix database user password |
-a <username> |
Optional MariaDB admin username (defaults to root if not specified) |
-m <password> |
MariaDB root or admin password — required only if socket authentication is disabled |
-h, --help |
Show the help screen (reflects detected socket status) |
Configuration
Once the installer completes, visit:
http://<domain>
And complete the setup.
Features
- Installs and configures Zabbix LTS automatically
- Creates the MariaDB database and user with the correct privileges
- Enables and starts Zabbix server and agent services
- Detects MariaDB socket or password authentication automatically
- Generates an Nginx host configuration dynamically
- Integrates cleanly with PHP-FPM and Nginx setups
- Supports re-runs via
IF NOT EXISTSlogic for safe idempotency
Configuration Details
File Locations
| File | Description |
|---|---|
/etc/zabbix/zabbix_server.conf |
Main Zabbix server configuration file |
/usr/share/zabbix-sql-scripts/mysql/server.sql.gz |
Database schema file imported by installer |
/etc/nginx/conf.d/<domain>.conf |
Generated Nginx host configuration file |
/etc/nginx/nginx-snippets |
Shared include snippets and templates |
Behavior
- The installer checks if MariaDB socket authentication is active.
If available, it connects locally asroot(no password). - If socket authentication is not detected, use
-aand-mto supply credentials. - Automatically sets and resets
log_bin_trust_function_creatorsduring import. - Nginx configuration is validated (
nginx -t) before restarting.
Nginx Integration
The generated Zabbix configuration file listens on port 80.
To enable HTTPS (port 443), use the example provided here.
Note
The file also includes optional caching directives (commented out by default). You can enable them to improve load times and performance if needed. The lines you are looking for are at the bottom of the generated config file and look like this:
##### Cache js css static content and open files start ##################### # include /etc/nginx/nginx-snippets/cache-open-files.conf; # include /etc/nginx/nginx-snippets/cache-statics.conf; # include /etc/nginx/nginx-snippets/cache-js-css.conf; ##### Cache js css static content and open files stop ######################
Troubleshooting
Nginx fails to restart
Run nginx -t and review any syntax errors reported in /etc/nginx/conf.d/<domain>.conf.
Access denied during database creation
Your MariaDB setup likely does not use socket authentication.
Re-run the installer with the -m flag (and optionally -a) to provide credentials.
The installer will automatically re-detect your configuration.
PHP version mismatch
The script automatically detects your installed PHP version,
but ensure that the PHP-FPM service (e.g., php8.3-fpm) is active.
Schema import fails
Verify that /usr/share/zabbix-sql-scripts/mysql/server.sql.gz exists.
If missing, reinstall the zabbix-sql-scripts package.
FAQ
Q: Why doesn’t the script ask for a MariaDB password by default?
A: Ubuntu 24.04’s MariaDB defaults to socket authentication,
allowing the local root user to connect without a password.
The installer detects this automatically and skips password prompts when applicable.
Q: Can I run the installer multiple times?
A: Yes. Database and user creation use IF NOT EXISTS, making re-runs safe.
Existing Nginx configuration files are replaced, but no data is deleted.
Q: Does this modify existing Nginx settings?
A: No. It adds a standalone host file in /etc/nginx/conf.d/
and validates configuration changes before applying them.
More Information
More guides and documentation can be found on wiki.x-files.dk
License
Licensed under the MIT License.