Zabbix 3.4 upgrade 5.0 practice document
Other versions are also applicable
table of Contents
- Stop Zabbix service before starting the upgrade
- backup database
- Download the ZABBIX5.0 source package from the official website:
- Unzip the compressed package
- Upgrade PHP version:
5.1 Uninstall the old version of PHP
5.2 Update YUM source
5.3 View available PHP packages
5.4 Install PHP commonly used modules
5.5 Start PHP-FPM
5.6 Set boot auto-start
5.7 Check whether the boot-up auto-start is set successfully
5.8 Modify PHP.INI Configuration - Enter the CD ZABBIX-5.0.2 directory to compile
- Create a soft connection:
- Delete old web files
- Delete the old startup script
- Copy the new WEB interface
- Copy the new startup script
- Modify ZABBIX_SERVER.CONF configuration file
- Stop the zabbix service before starting the upgrade.
Note: (Data cannot be generated during the upgrade)
systemctl stop zabbix_server
systemctl stop zabbix_agentd - Backup database
mysql -uzabbix -p zabbix> /opt/database.sql (database storage location, decide where to store it yourself) - Download the zabbix5.0 source package from the official website:
https://www.zabbix.com/download_sources - Unzip the compressed package and
store /opt/ (the storage location is determined by yourself)
tar zxvf zabbix-5.0.2.tar.gz - Upgrade PHP version:
5.1 Uninstall the old version PHP
rpm -qa |grep php|xargs -i rpm -e {} --nodeps
5.2 Update yum source
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel- release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
5.3 View available PHP packages
(you can also check before updating the source to see if it contains 7.2 Version package.)
yum list |grep php
5.4 Install PHP commonly used modules
yum clean all (clear yum cache)
yum -y install php72w php72w-fpm \php72w-mbstring php72w-common php72w-gd \php72w-mysql php72w-xml php72w -cli php72w-devel \php72w-pecl-memcached php72w-pecl-redis php72w-opcache php72w-ldap php72w-bcmath After the
upgrade is complete, enter php -v to confirm whether the upgrade is successful.
5.5 Start php-fpm
systemctl start php-fpm
5.6 Set automatic startup
systemctl enable php-fpm.service
5.7 Check whether the boot-up auto-start setting is successful
systemctl list-dependencies | grep php-fpm
5.8 Modify the configuration of php.ini
vim /etc/php.ini
post_max_size = 16M //Modify
max_execution_time = 300 //Modify
max_input_time = 300 //Modify
date .timezone = Asia/Shanghai //Add and cancel the comment - Enter the cd zabbix-5.0.2 directory to compile
. /configure --prefix=/opt/Zabbix/zabbix-5.0.2 --enable-server --enable-agent --enable-ipv6 --with-mysql- -with-net-snmp --with-libcurl --with-openipmi --with-unixodbc --with-libxml2 --with-ssh2 --enable-java
–prefix=/opt/Zabbix/zabbix-5.0.2( This path is adjusted according to the path where the real environment is located.)
Depending on the environment, some packages may be missing in the compilation process. If an error is reported, search for Baidu and use yum to fill in the missing rpm package.
Then execute the compilation again
without error, please execute directly according to the prompt:
make install - Create a soft connection:
rm -rf /opt/Zabbix/zabbix (to prevent it from still leading to the old version, if you are afraid of accidents when deleting this file, please backup this file)
ln -s /opt/Zabbix/zabbix-5.0.2 / opt/Zabbix/zabbix - Delete the old web files
rm -rf /var/www/html/zabbix/* - Delete the old startup script
rm -rf /etc/init.d/zabbix_* - Copy the new web interface
Note: (The interface where version 5.0 is located has changed the directory storage, under the ui directory)
cp -r /opt/Zabbix/zabbix-5.0.2/ui/* /var/www/html/zabbix - Copy the new startup script
Note: The directory where the 5.0 startup script is located: /opt/Zabbix/zabbix-5.0.2/misc/init.d/fedora/core/
cp /opt/Zabbix/zabbix-5.0.2/misc/init. d/fedora/core/zabbix_* /etc/init.d/
chmod 755 /etc/init.d/zabbix_* - Modify the zabbix_server.conf configuration file.
Modify the configuration file. Please find the directory where zabbix_server.conf is located according to your real environment. Enter the /opt/Zabbix/etc/ directory,
vim /opt/Zabbix/etc/zabbix_server.conf
DBName= zabbix / /Modify
DBUser=zabbix //Modify
DBPassword=password //Modify the password here and replace it with the password of the real environment. Go
to the /etc/ini.d/ directory under
vim /etc/init.d/zabbix_server
vim /etc/init.d /zabbix_agentd Both
zabbix_server and zabbix_agentd must modify this configuration.
BASEDIR=/opt/Zabbix/zabbix/ //Modify
Finally start the service:
systemctl daemon-reload
service zabbix_server start
service zabbix_agentd start
Check the database upgrade status: tail -f /tmp/zabbix_server.log
wait for completion
Note: The zabbix upgrade at this stage automatically updates the database structure. The specific process of the upgrade log is viewed in zabbix_server.log. The path location where the log is generated should be searched according to the actual situation. Generally, the default is /tmp/ under the path.
Restart the zabbix_sercer service:
service zabbix_server restart
open the browser, enter http://ip/zabbix/setup.php (this IP is the host IP deployed by zabbix_server), and enter the interface shown in the figure below.
If there is an error in this step, enter /etc/php.ini, modify php.ini, please refer to 5.8 for specific modification configuration, or modify according to the page configuration requirements (Required). After the modification is completed, refresh the interface to enter the next step.
Upload zabbix_server.conf.php to /var/www/html/zabbix/conf/ path.
Then restart the zabbix_server service
service zabbix_server restart to
enter the interface, that is, the installation is complete.
FAQ:
- If you enter this interface, the following error appears:
If this problem occurs, check the log information, tail -f /tmp/Zabbix_server/log (log storage path, which can be customized and modified, here is the default). The main problem is that the database is not connected. At this time, check whether the DBpassword ='' in etc/Zabbix/zabbix/zabbix_server.conf is set to empty. If it is empty, set password ='zabbix' (database password). Please find the path etc/Zabbix/zabbix/ according to the actual situation.
If you upgrade normally according to the document, this problem will not occur.