Compare commits

...

1 Commits

Author SHA1 Message Date
2211561872 [Fix] Zabbix: Add version-specific SQL script path for 7.0 LTS
Fixes installation failure for Zabbix 7.0 LTS caused by incorrect SQL script path.

Issue: Zabbix 7.0 LTS uses a different directory structure than 7.4 and 8.0:
- Zabbix 7.0 LTS: /usr/share/zabbix-sql-scripts/postgresql/server.sql.gz
- Zabbix 7.4+:    /usr/share/zabbix/sql-scripts/postgresql/server.sql.gz

The installer was hardcoded to use the newer path, causing 7.0 installations
to fail with: 'gzip: /usr/share/zabbix/sql-scripts/postgresql/server.sql.gz:
No such file or directory'

Solution:
Added version detection to use the correct SQL script path based on selected
Zabbix version. This ensures all supported versions (7.0 LTS, 7.4, 8.0) can
initialize their PostgreSQL database correctly.

Tested versions:
- 7.0 LTS: Now uses correct path and installs successfully
- 7.4: Continues to work with existing path
- 8.0: Continues to work with existing path

Fixes issue reported by @zjjiao in discussion with @MickLesk
2025-12-19 13:37:56 +01:00

View File

@ -44,7 +44,14 @@ curl -fsSL "$ZABBIX_DEB_URL" -o /tmp/"$ZABBIX_DEB_FILE"
$STD dpkg -i /tmp/"$ZABBIX_DEB_FILE"
$STD apt update
$STD apt install -y zabbix-server-pgsql zabbix-frontend-php php8.4-pgsql zabbix-apache-conf zabbix-sql-scripts
zcat /usr/share/zabbix/sql-scripts/postgresql/server.sql.gz | sudo -u "$PG_DB_USER" psql "$PG_DB_NAME" &>/dev/null
if [[ "$ZABBIX_VERSION" == "7.0" ]]; then
ZABBIX_SQL="/usr/share/zabbix-sql-scripts/postgresql/server.sql.gz"
else
ZABBIX_SQL="/usr/share/zabbix/sql-scripts/postgresql/server.sql.gz"
fi
zcat "$ZABBIX_SQL" | sudo -u "$PG_DB_USER" psql "$PG_DB_NAME" &>/dev/null
sed -i "s/^DBName=.*/DBName=$PG_DB_NAME/" /etc/zabbix/zabbix_server.conf
sed -i "s/^DBUser=.*/DBUser=$PG_DB_USER/" /etc/zabbix/zabbix_server.conf
sed -i "s/^# DBPassword=.*/DBPassword=$PG_DB_PASS/" /etc/zabbix/zabbix_server.conf