Install Zabbix 3.4 on CentOS 7.4
[Date: 2017-09-30] | Source: cnblogs.com/it-hack Author: it-hack | [Font: large, medium and small ] |
1. Installation environment
1 [root@linuxidc ~]# cat /etc/RedHat-release 2 3 CentOS Linux release 7.4.1708 (Core)
turn off firewall
1 [root@linuxidc ~]# systemctl stop firewalld.service #Close the firewall 2 3 [root@linuxidc ~]# systemctl disable firewalld.service #Do not start the firewall at boot 4
close selinux
1 [root@linuxidc ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config #在/etc/selinux/config 把SELNUX=enforcing换成SELINUX=disabled 2 3 [root@linuxidc ~]# grep SELINUX=disabled /etc/selinux/config #Filter the disabled just changed 4 5 SELINUX=disabled 6 7 [root@linuxidc ~]# setenforce 0 #Clear the configuration of selinux 8 9 setenforce: SELinux is disabled
Second, the installation and configuration of the database
The MariaDB database management system is a fork of MySQL, mainly maintained by the open source community and licensed under the GPL.
The reason for developing this branch is: after Oracle acquired MySQL, there is a potential risk of closing MySQL, so the community adopts the method of branching to avoid this risk.
MariaDB is designed to be fully compatible with MySQL, including API and command line, making it an easy replacement for MySQL.
install mariadb
[root@linuxidc ~]# yum install mariadb-server mariadb –y
Loaded plugins: fastestmirror, langpacks
base
The installation process is omitted in the middle
It has been installed:
mariadb.x86_64 1:5.5.56-2.el7 mariadb-server.x86_64 1:5.5.56-2.el7
Installed as a dependency:
perl-DBD-MySQL.x86_64 0:4.023-5.el7
Upgraded as a dependency:
mariadb-libs.x86_64 1:5.5.56-2.el7
complete!
The relevant commands for the mariadb database are:
1 [root@linuxidc ~]# systemctl start mariadb #启动MariaDB 2 3 [root@linuxidc ~]# systemctl stop mariadb #停止MariaDB 4 5 [root@linuxidc ~]# systemctl restart mariadb #重启MariaDB 6 7 [root@linuxidc ~]# systemctl enable mariadb #Set boot up
Three, Zabbix3.4 installation and configuration
Install zabbix3.4
1 [root@linuxidc ~]# rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-1.el7.centos.noarch.rpm
Get http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-1.el7.centos.noarch.rpm
Preparing... ################################# [100%]
Upgrading/installing...
1:zabbix-release-3.4-1.el7.centos ################################# [100%]
[root@linuxidc ~]# yum install zabbix-server-mysql zabbix-web-mysql -y
Get http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-1.el7.centos.noarch.rpm
Preparing... ################################# [100%]
Upgrading/installing...
1:zabbix-release-3.4-1.el7.centos ################################# [100%]
1 [root@linuxidc ~]# yum install zabbix-server-mysql zabbix-web-mysql -y
Loaded plugins: fastestmirror, langpacks
zabbix | 2.9 kB 00:00:00
zabbix-non-supported | 951 B 00:00:00
zabbix/x86_64/primary_db | 18 kB 00:00:00
zabbix-non-supported/x86_64/primary | 1.6 kB 00:00:00
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* epel: mirrors.neusoft.edu.cn
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
zabbix-non-supported 4/4
Installation skips the intermediate process
It has been installed:
zabbix-server-mysql.x86_64 0:3.4.1-1.el7 zabbix-web-mysql.noarch 0:3.4.1-1.el7
Installed as a dependency:
OpenIPMI-libs.x86_64 0:2.0.19-15.el7 OpenIPMI-modalias.x86_64 0:2.0.19-15.el7 fping.x86_64 0:3.10-4.el7
httpd.x86_64 0:2.4.6-67.el7.centos.2 httpd-tools.x86_64 0:2.4.6-67.el7.centos.2 iksemel.x86_64 0:1.4-6.el7
libzip.x86_64 0:0.10.1-8.el7 mailcap.noarch 0:2.1.41-2.el7 php.x86_64 0:5.4.16-42.el7
php-bcmath.x86_64 0:5.4.16-42.el7 php-cli.x86_64 0:5.4.16-42.el7 php-common.x86_64 0:5.4.16-42.el7
php-gd.x86_64 0:5.4.16-42.el7 php-ldap.x86_64 0:5.4.16-42.el7 php-mbstring.x86_64 0:5.4.16-42.el7
php-mysql.x86_64 0:5.4.16-42.el7 php-pdo.x86_64 0:5.4.16-42.el7 php-xml.x86_64 0:5.4.16-42.el7
t1lib.x86_64 0:5.1.2-14.el7 unixODBC.x86_64 0:2.3.1-11.el7 zabbix-web.noarch 0:3.4.1-1.el7
complete!
[root @linuxidc ~]#
create database
1 [root@linuxidc ~]# mysql 2 3 Welcome to the MariaDB monitor. Commands end with ; or \g. 4 5 Your MariaDB connection id is 2 6 7 Server version: 5.5.56-MariaDB MariaDB Server 8 9 10 11 Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others. 12 13 14 15 Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. 16 17 18 19 MariaDB [(none)]> 20 21 MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin; 22 23 Query OK, 1 row affected (0.00 sec) 24 25 MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix'; 26 27 Query OK, 0 rows affected (0.08 sec) 28 29 MariaDB [(none)]> exit 30 31 Bye
import database
[root@linuxidc ~]# zcat /usr/share/doc/zabbix-server-mysql-3.4.1/create.sql.gz |mysql -uzabbix -pzabbix zabbix
Configure database user and password
1 [root@linuxidc ~]# grep -n '^'[a-Z] /etc/zabbix/zabbix_server.conf 2 3 38:LogFile=/var/log/zabbix/zabbix_server.log 4 5 49:LogFileSize=0 6 7 72:PidFile=/var/run/zabbix/zabbix_server.pid 8 9 82:SocketDir=/var/run/zabbix 10 11 101:DBName=zabbix 12 13 117:DBUser=zabbix 14 15 316: SNMPTrapperFile = / var / log / snmptrap / snmptrap.log 16 17 434:Timeout=4 18 19 476:AlertScriptsPath=/usr/lib/zabbix/alertscripts 20 21 486:ExternalScripts=/usr/lib/zabbix/externalscripts 22 23 522:LogSlowQueries=3000
[root@linuxidc ~]# vim /etc/zabbix/zabbix_server.conf #修改配置文件
Start the zabbix server and set it to start on boot
1 [root@linuxidc ~]# systemctl start zabbix-server 2 3 [root@linuxidc ~]# systemctl enable zabbix-server 4
Edit Zabbix frontend PHP configuration, change time zone
1 [root @ linuxidc ~] # vim /etc/httpd/conf.d/zabbix.conf
Modified to Asia Shanghai
save and exit
SELinux configuration
1 [root@linuxidc ~]# setsebool -P httpd_can_connect_zabbix on 2 3 software: SELinux is disabled. 4 5 [root@linuxidc ~]# setsebool -P httpd_can_cetwork_connect_db on 6 7 software: SELinux is disabled.
Start httpd and set it to start on boot
1 [root@linuxidc ~]# systemctl start httpd #Start httpd service 2 3 [root@linuxidc ~]# systemctl enable httpd #Set the httpd service to start on boot
Fourth, install Zabbix Web
Browser access and installation
http://192.168.1.18/zabbix/
Click next step
Click next step
Enter the password for the database
Click next step
Click next step
After confirming that the information is correct
Click next step
After completing the installation, a configuration file will be generated in /etc/zabbix/web/zabbix.conf.php
Congratulations! You have successfully installed Zabbix frontend.
Configuration file "/etc/zabbix/web/zabbix.conf.php" created.
1 [root@linuxidc ~]# cat /etc/zabbix/web/zabbix.conf.php 2 3 <?php 4 5 // Zabbix GUI configuration file. 6 7 global $DB; 8 9 10 11 $DB['TYPE'] = 'MYSQL'; 12 13 $DB['SERVER'] = 'localhost'; 14 15 $DB['PORT'] = '0'; 16 17 $DB['DATABASE'] = 'zabbix'; 18 19 $DB['USER'] = 'zabbix'; 20 21 $DB['PASSWORD'] = 'zabbix'; 22 23 24 25 // Schema name. Used for IBM DB2 and PostgreSQL. 26 27 $DB['SCHEMA'] = ''; 28 29 30 31 $ZBX_SERVER = 'localhost'; 32 33 $ZBX_SERVER_PORT = '10051'; 34 35 $ZBX_SERVER_NAME = 'Zabbix Monitoring Platform'; 36 37 38 39 $IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG; 40 41 [root@linuxidc ~]#
click finish
Log in to the latest version of Zabbix3.4 Default user Admin Default password zabbix
After entering your username and password, click sign in
The installation is over
Five, zabbxi-agent installation and configuration
Install zabbxi-agent
1 [root@linuxidc ~]# yum install zabbix-agent –y 2 3 Loaded plugins: fastestmirror, langpacks 4 5 Loading mirror speeds from cached hostfile 6 7 * base: mirrors.aliyun.com 8 9 * epel: mirrors.tuna.tsinghua.edu.cn 10 11 * extras: mirrors.aliyun.com 12 13 * updates: mirrors.aliyun.com 14 15 Resolving dependencies 16 17 There are unfinished transactions remaining. You might consider running yum-complete-transaction, or "yum-complete-transaction --cleanup-only" and "yum history redo last", first to finish them. If those don't work you'll have to try removing/installing packages by hand (maybe package-cleanup can help). 18 19 --> Checking transaction 20 21 ---> Package zabbix-agent.x86_64.0.3.4.1-1.el7 will be installed 22 23 --> Resolve dependencies complete 24 25 26 27 Dependency Resolution 28 29 30 31 ===================================================================================================================================================== 32 33 Package schema version source size 34 35 ===================================================================================================================================================== 36 37 Installing: 38 39 zabbix-agent x86_64 3.4.1-1.el7 zabbix 353 k 40 41 42 43 Transaction Summary 44 45 ===================================================================================================================================================== 46 47 Install 1 package 48 49 50 51 Total downloads: 353k 52 53 Installation size: 1.3 M 54 55 Downloading packages: 56 57 zabbix-agent-3.4.1-1.el7.x86_64.rpm | 353 kB 00:00:04 58 59 Running transaction check 60 61 Running transaction test 62 63 Transaction test succeeded 64 65 Running transaction 66 67 Installing: zabbix-agent-3.4.1-1.el7.x86_64 1/1 68 69 Verifying: zabbix-agent-3.4.1-1.el7.x86_64 1/1 70 71 72 73 installed: 74 75 zabbix-agent.x86_64 0:3.4.1-1.el7 76 77 78 79 Done! 80 81
Configure zabbxi-agent
1 [root @ linuxidc ~] # vim /etc/zabbix/zabbix_agentd.conf
Modify IP address server IP address
Enter IP address
Modify serverActive IP address
Enter IP address
Start zabbxi-agent and set startup
[root@linuxidc ~]# systemctl restart zabbix-agent.service
[root@linuxidc ~]# systemctl enable zabbix-agent.service
More Zabbix related tutorial collections :
Install Zabbix 3.2 on Ubuntu 16.04 server http://www.linuxidc.com/Linux/2017-07/145519.htm
CentOS 7 LNMP environment to build Zabbix3.0 http://www.linuxidc.com/Linux/2017-02/140134.htm
Ubuntu 16.04 installation and deployment monitoring system Zabbix2.4 http://www.linuxidc.com/Linux/2017-03/141436.htm
Zabbix monitoring installation deployment and alarm configuration http://www.linuxidc.com/Linux/2017-03/141611.htm
Detailed explanation of Zabbix trigger expressionshttp ://www.linuxidc.com/Linux/2017-03/141921.htm
Install and deploy Zabbix3.0 under Ubuntu 16.04 http://www.linuxidc.com/Linux/2017-02/140395.htm
Zabbix monitoring apache server-status under CentOS 6.3 http://www.linuxidc.com/Linux/2013-05/84740.htm
Detailed installation of Zabbix 3.0 under CentOS 7http : //www.linuxidc.com/Linux/2017-03/141716.htm
Install Zabbix 2.0.6 under 64-bit CentOS 6.2 http://www.linuxidc.com/Linux/2014-11/109541.htm
Detailed introduction of ZABBIX : please click here
ZABBIX download address : please click here