Skip to content

Instantly share code, notes, and snippets.

@yosida95
Last active August 29, 2015 14:04
Show Gist options
  • Select an option

  • Save yosida95/a384cb6e571f6ce29b65 to your computer and use it in GitHub Desktop.

Select an option

Save yosida95/a384cb6e571f6ce29b65 to your computer and use it in GitHub Desktop.
cd $HOME
# Stop Zabbix Server (1.8)
sudo service zabbix-server stop
# Create a backup
mkdir ./zabbix-backup
mysqldump -uroot -p zabbix > ./zabbix-backup/dump.db
sudo cp /etc/zabbix/{apache.conf,zabbix_server.conf} ./zabbix-backup
sudo cp -r /etc/zabbix/alert.d ./zabbix-backup
# Remove Zabbix Server (1.8) and Zabbix frontend
sudo apt-get remove zabbix-server-mysql zabbix-frontend-php
# Add official apt repositories
sudo zsh -c 'cat << EOF > /etc/apt/sources.list.d/zabbix.list
deb http://repo.zabbix.com/zabbix/2.2/ubuntu/ precise main
deb-src http://repo.zabbix.com/zabbix/2.2/ubuntu/ precise main
EOF'
curl -o - http://repo.zabbix.com/zabbix-official-repo.key| sudo apt-key add -
sudo apt-get update
# Make sure Zabbix Server(2.2) will be installed and install it
sudo apt-cache policy zabbix-server-mysql zabbix-frontend-php
sudo apt-get install zabbix-server-mysql zabbix-frontend-php
sudo service zabbix-server stop
# Edit configuration file
sudo vimdiff ./zabbix-backup/zabbix_server.conf /etc/zabbix/zabbix_server.conf
sudo vimdiff ./zabbix-backup/apache.conf /etc/zabbix/apache.conf
# Download source code of Zabbix Server(2.2) and migrate database schemas from 1.8's one to 2.0's
apt-get source zabbix-server-mysql
cd ./zabbix-2.2.5/upgrades/dbpatches/2.0
mysql -uroot -p zabbix < ./patch.sql
# Start Zabbix Server(2.2) and monitor progress of auto database schema migration
sudo service zabbix-server-mysql start
watch 'sudo tail -n 20 /var/log/zabbix/zabbix_server.log'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment