Zabbix 3.2 Installation Notes

I. Installation of Virtual Machines

Virtual Machine Configuration:
1 Core 2G, 20G Hard Disk

Service packages selected at installation:
Select base, large systems performance, legacy unix compatibility in base system
Select mysql database client, mysql database server in database
desktops full selection
Select Chinese support in languages
Select server platform, system administration tools in servers
Select snmp support in system management
Select php support, web server, web servlet engine in web services

2. Configuring yum sources

Install epel source

[root@localhost ~]# yum -y install epel-release

Install webtatic source

[root@localhost ~]# rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
Retrieving http://mirror.webtatic.com/yum/el6/latest.rpm
warning: /var/tmp/rpm-tmp.LS63Uk: Header V4 DSA/SHA1 Signature, key ID cf4c4ff9: NOKEY
Preparing...                ########################################### [100%]
   1:webtatic-release       ########################################### [100%]

Configuration of zabbix source

vim /etc/yum.repos.d/zabbix.repo
[zabbix]
name=zabbix
baseurl=http://repo.zabbix.com/zabbix/3.2/rhel/6/x86_64/
enabled=1
gpgcheck=0

[zabbix-deprecated]
name=zabbix-deprecated
baseurl=http://repo.zabbix.com/zabbix/3.2/rhel/6/x86_64/deprecated/
enabled=1
gpgcheck=0

Empty the yum cache and rebuild the yum cache

[root@localhost ~]# yum clean all
[root@localhost ~]# yum repolist
[root@localhost ~]# yum makecache

#
Upgrade PHP version

Since ZABBIX version 3.2 requires php version 5.6 or more to support, the php version installed by default centos is 5.3.3, so the php version needs to be upgraded.

1. View the current version of php

[root@localhost ~]# php -v

2. Remove the currently installed version of php

[root@localhost ~]# yum remove php*

3. Install PHP version 5.6

[root@localhost ~]# yum install php56w php56w-devel php56w-common php56w-mysql php56w-pdo php56w-opacache php56w-xml

[root@localhost ~]# php -v
PHP 5.6.30 (cli) (built: Jan 19 2017 22:50:24) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies

Editing mysql configuration file

1. Edit / etc/my.cnf and add the following to prevent Chinese scrambling

[root@localhost ~]# vim /etc/my.cnf 

#Set the character set to utf8
character-set-server=utf8

#Let each table file of innodb be stored separately
innodb_file_per_table=1

2. Start mysql service and set up boot auto-start

[root@localhost ~]# service mysqld start
[root@localhost ~]# chkconfig mysqld on

3. Setting mysql service root password

[root@localhost ~]# mysqladmin -uroot password root

4. Creating database and user authorization

[root@localhost ~]# mysql -uroot -proot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.1.71 Source distribution

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create database zabbix character set utf8
    -> ;
Query OK, 1 row affected (0.00 sec)

mysql> grant all privileges on zabbix.* to zabbix@'localhost' identified by 'zabbix';
Query OK, 0 rows affected (0.00 sec)

mysql> grant all privileges on zabbix.* to zabbix@'192.168.159.%' identified by 'zabbix';
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye

V. Installation of zabbix

1. yum installs zabbix

[root@localhost ~]# yum install zabbix-agent zabbix-get zabbix-java-gateway zabbix-proxy zabbix-proxy-mysql zabbix-release zabbix-sender zabbix-server zabbix-server-mysql zabbix-web zabbix-web-mysql

2. Decompress sql import file

[root@localhost ~]# cd /usr/share/doc/zabbix-server-mysql-3.2.4/

[root@localhost zabbix-server-mysql-3.2.4]# ls
AUTHORS  ChangeLog  COPYING  create.sql.gz  NEWS  README

[root@localhost zabbix-server-mysql-3.2.4]# gunzip create.sql.gz 

[root@localhost zabbix-server-mysql-3.2.4]# ls
AUTHORS  ChangeLog  COPYING  create.sql  NEWS  README

3. Import sql file into mysql

[root@localhost zabbix-server-mysql-3.2.4]# mysql -uzabbix -pzabbix
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.1.71 Source distribution

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use zabbix;
Database changed

mysql> source /usr/share/doc/zabbix-server-mysql-3.2.4/create.sql ;

mysql> show tables;

mysql> exit;

3. Editing/etc/zabbix/zabbix_server.conf

vim /etc/zabbix/zabbix_server.conf
DBPassword=zabbix

4. Create the required directories

mkdir /etc/zabbix/alertscripts /etc/zabbix/externalscripts

5. Start zabbix service

[root@localhost ~]# setenforce 0
[root@localhost ~]# getenforce 
Permissive
[root@localhost ~]# service zabbix-server restart
Shutting down Zabbix server:                               [FAILED]
Starting Zabbix server:                                    [  OK  ]
[root@localhost ~]# service zabbix-server status
zabbix_server (pid  8693) is running...
[root@localhost ~]# chkconfig zabbix-server on

6. Configure apache service and start it

1. Edit / etc/httpd/conf/httpd.conf and modify the following

vim /etc/httpd/conf/httpd.conf
ServerName localhost:80

2. Start httpd service and start it automatically

[root@localhost ~]# service httpd start
Starting httpd:                                            [  OK  ]
[root@localhost ~]# chkconfig httpd on

3. Other configurations

Stop iptables
[root@localhost ~]# service iptables stop
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Unloading modules:                               [  OK  ]

Copy the zabbix directory in / usr/share / directory to / var/www/html / directory
cp -r /usr/share/zabbix /var/www/html/

7. Open and continue to configure zabbix in browser

1. Open in the browser http://192.168.159.253/zabbix

2. Click on the next step, this page is the parameter detection of php. If it does not pass, modify it until it passes. Modify it at php.ini. Remember to restart httpd after the change.

3. Modify the php configuration file

[root@localhost ~]# vim /etc/php.ini
post_max_size = 16M
max_execution_time = 300
max_input_time = 300
date.timezone = Asia/Shanghai
bcmath.scale = 1
always_populate_raw_post_data = -1
#Save the exit after modifying the above parameters

#Install php plug-ins bcmath, mbstring, gd
[root@localhost ~]# yum install -y php56w-gd php56w-bcmath php56w-mbstring

#Restart httpd service
[root@localhost ~]# service httpd restart

4. Click back and click again to check next step

5. Click on the next step, mysql database detection, user name and password to fill in the just created zabbix

6. Click Next and leave this page by default

7. Overview of Information

8. After installation, click finish to complete the installation.

9. Log in. The default username password is admin/zabbix

Tags: Zabbix MySQL PHP yum

Posted on Tue, 09 Apr 2019 21:57:32 -0400 by macpaul