Skip to content

Instantly share code, notes, and snippets.

@PackeTsar
Created September 3, 2024 13:59
Show Gist options
  • Save PackeTsar/32d092ed4c83d3d8cc03b741ade6d986 to your computer and use it in GitHub Desktop.
Save PackeTsar/32d092ed4c83d3d8cc03b741ade6d986 to your computer and use it in GitHub Desktop.
Zabbix Server 6-to-7 Upgrade

Zabbix Server 6-to-7 Upgrade

Backup Files

  • Partial backup of the database
sudo mysqldump --no-data zabbix > zabbix_backup.sql

sudo mysqldump --no-create-info --ignore-table=zabbix.history --ignore-table=zabbix.history_uint --ignore-table=zabbix.history_text --ignore-table=zabbix.history_log --ignore-table=zabbix.history_str --ignore-table=zabbix.trends --ignore-table=zabbix.trends_uint --ignore-table=zabbix.auditlog zabbix >> zabbix_backup.sql
  • Full backup of the database: mysqldump zabbix > zabbix_backup_full.sql
  • Copy config files
sudo cp /etc/zabbix/zabbix_server.conf .
sudo cp /etc/zabbix/zabbix_agent2.conf .
  • Save server config file parameters: sudo grep "^[^#]" /etc/zabbix/zabbix_server.conf | tee server_params
  • Save agent config file parameters: sudo grep "^[^#]" /etc/zabbix/zabbix_agent2.conf | tee agent2_params

Stop Services

  • Stop Zabbix Server service: sudo systemctl stop zabbix-server.service
  • Stop Zabbix Agent service: sudo systemctl stop zabbix-agent2.service
  • Stop Apache service: sudo systemctl stop apache2.service

Upgrade

  • Remove the current Zabbix repo source: sudo rm -Rf /etc/apt/sources.list.d/zabbix.list
  • Download repo source: wget https://repo.zabbix.com/zabbix/7.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_7.0-2+ubuntu22.04_all.deb
  • Install source: sudo dpkg -i zabbix-release_7.0-2+ubuntu22.04_all.deb
    • Overwrite of /etc/apt/sources.list.d/zabbix.list: Yes
  • Update from sources: sudo apt update
  • Upgrade: sudo apt upgrade -y
    • When asking to overwrite files, use "D" to show the file differences. Save those differences so you can put back the parameters later

Fix Config Files

  • Edit the server config: sudo nano /etc/zabbix/zabbix_server.conf
    • Put custom parameters back
  • Edit the server config: sudo nano /etc/zabbix/zabbix_agent2.conf
    • Put custom parameters back

Start Services

  • In a separate SSH session, monitor the Zabbix server log sudo tail -f /var/log/zabbix/zabbix_server.log
  • Start the Zabbix Server service: sudo systemctl start zabbix-server.service
  • Start the Zabbix Agent service: sudo systemctl start zabbix-agent2.service
  • Start the Apache service: sudo systemctl start apache2.service
    • If service won't start and journalctl complains about missing plugins, might need to sudo apt install zabbix-agent2-plugin-postgresql zabbix-agent2-plugin-mongodb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment