Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install and configure zabbix

2025-04-13 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

How to install and configure zabbix, I believe that many inexperienced people do not know what to do. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

ZABBIX server installation

Zabbix server side requires LAMP environment, that is, linux, appache, mysql, php

Linux:CentOS release 6.5

Appache:2.2.15

Mysql:5.6

Php:5.6.13

Zabbix:3.0.3

1. Install appache

CentOS6 installs appache by default and does not need to be reinstalled

[root@oatest] # httpd-v

Server version: Apache/2.2.15 (Unix)

Server built: Oct 19 2017 16:43:38

[root@oatest] # apachectl-v

Server version: Apache/2.2.15 (Unix)

Server built: Oct 19 2017 16:43:38

two。 Install PHP

The minimum requirement for PHP in Zabbix 3.0 is 5.4, while the default is 5.3.3 for CentOS 6, which does not meet the requirements at all. Therefore, it is necessary to use a third party source to upgrade PHP to 5.6, download address http://cn2.php.net/distributions/php-5.6.13.tar.gz.

[root@oatest ~] # cat / etc/issue

CentOS release 6.5 (Final)

[root@oatest ~] # rpm-qa | grep-I php

Php-common-5.3.3-49.el6.x86_64

Php-cli-5.3.3-49.el6.x86_64

Php-5.3.3-49.el6.x86_64

[root@oatest] # rpm-e php-5.3.3-49.el6.x86_64

[root@oatest] # rpm-e php-cli-5.3.3-49.el6.x86_64

[root@oatest] # rpm-e php-common-5.3.3-49.el6.x86_64

[root@oatest ~] # cd / u01/software/

[root@oatest software] # tar-zxvf php-5.6.13.tar.gz

[root@oatest software] # cd php-5.6.13

[root@oatest php-5.6.13] # / configure-- prefix=/usr/local/php-- with-apxs2=/usr/local/apache/bin/apxs-- with-mysqli

-- error report / usr/local/apache/bin/apxs: No such file or directoryconfigure

[root@oatest php-5.6.13] # find /-name apxs

-- No results.

[root@oatest php-5.6.13] # yum install-y httpd-devel

[root@oatest php-5.6.13] # find /-name apxs

-- display the results / usr/sbin/apxs

[root@oatest php-5.6.13] # / configure-- prefix=/usr/local/php-- with-apxs2=/usr/sbin/apxs-- with-mysqli

[root@oatest php-5.6.13] # make

-- prompt Don't forget to run 'make test'

-- there is no need to run this make test

[root@oatest php-5.6.13] # make install

[root@oatest php-5.6.13] # php- version

[root@oatest php-5.6.13] # vi / etc/httpd/conf/httpd.conf

Find:

AddType application/x-compress .Z

AddType application/x-gzip .gz .tgz

Add the following:

AddType application/x-httpd-php .php # (make Apcche support PHP)

AddType application/x-httpd-php-source .php5

[root@oatest php-5.6.13] # service httpd restart

-- create a file index.php in the / var/www/html/ directory, as follows

Http://IP/index.php

Check to see if appche can display the contents of php properly.

You can see the path of php.ini, Configuration File (php.ini) Path/usr/local/php/lib

[root@oatest php-5.6.13] # cp php.ini-development / usr/local/php/lib/php.ini

[root@oatest php-5.6.13] # vi / usr/local/php/lib/php.ini

Add the following

Date.timezone = Asia/Shanghai

Post_max_size = 32m

Max_execution_time = 300

Max_input_time = 300

Always_populate_raw_post_data =-1

3. Install MySQL

MySQL recommends version 5.6, and CentOS6 defaults to 5.1. It is not recommended.

[root@oatest ~] # cat / etc/issue

CentOS release 6.5 (Final)

[root@oatest ~] # rpm-qa | grep-I mysql

Mysql-libs-5.1.71-1.el6.x86_64

[root@oatest] # rpm-e mysql-libs-5.1.71-1.el6.x86_64-- nodeps

[root@oatest ~] # cd / u01/software/

[root@oatest software] # rpm-ivh MySQL-client-5.6.10-1.rhel5.x86_64.rpm MySQL-server-5.6.10-1.rhel5.x86_64.rpm MySQL-devel-5.6.10-1.el6.x86_64.rpm MySQL-shared-5.6.10-1.el6.x86_64.rpm MySQL-shared-compat-5.6.10-1.el6.x86_64.rpm

-- MySQL-devel must be installed, or an error configure: error: MySQL library not found will be reported in the configure of the later zabbix installation

-- MySQL-shared must be installed, or an error configure: error: Not found mysqlclient library will be reported in the configure of the later zabbix installation

[root@oatest software] # service mysql start

[root@oatest software] # cat / root/.mysql_secret

# The random password set for the root user at Tue Aug 28 18:14:24 2018 (local time): kmRkDSXX

[root@oatest software] # mysql-u root-p

Enter password: enter the kmRkDSXX above

Mysql > SET PASSWORD = PASSWORD ('123456')

Mysql > CREATE DATABASE zabbix CHARACTER SET utf8 COLLATE utf8_bin

Mysql > GRANT ALL PRIVILEGES ON zabbix.* TO zabbix@localhost IDENTIFIED BY 'zabbix'

Mysql > flush privileges

4. Install Zabbix

Zabbix download address http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/3.0.3/zabbix-3.0.3.tar.gz

[root@oatest ~] # cd / u01/software/

[root@oatest software] # useradd zabbix

[root@oatest software] # tar-zxvf zabbix-3.0.3.tar.gz

[root@oatest software] # cd zabbix-3.0.3

[root@oatest zabbix-3.0.3] # / usr/bin/mysql-uzabbix-pzabbix zabbix < database/mysql/schema.sql

[root@oatest zabbix-3.0.3] # / usr/bin/mysql-uzabbix-pzabbix zabbix < database/mysql/images.sql

[root@oatest zabbix-3.0.3] # / usr/bin/mysql-uzabbix-pzabbix zabbix < database/mysql/data.sql

[root@oatest zabbix-3.0.3] # / configure-- prefix=/usr/local/zabbix-- sysconfdir=/etc/zabbix/-- enable-server-- enable-agent-- with-net-snmp-- with-libcurl-- with-mysql-- with-libxml2-- with-ldap

-- error configure: error: Invalid Net-SNMP directory-unable to find net-snmp-config

-- error configure: error: Curl library not found

[root@oatest zabbix-3.0.3] # yum install net-snmp-devel

[root@oatest zabbix-3.0.3] # yum install curl-devel

[root@oatest zabbix-3.0.3] # / configure-- prefix=/usr/local/zabbix-- sysconfdir=/etc/zabbix/-- enable-server-- enable-agent-- with-net-snmp-- with-libcurl-- with-mysql-- with-libxml2

[root@oatest zabbix-3.0.3] # make install

5. Zabbix and appache configuration

[root@oatest zabbix-3.0.3] # vi / etc/zabbix/zabbix_server.conf

Modify

DBPassword=zabbix

ListenIP=127.0.0.1192.168.30.173

-- here 192.168.30.173 is zabbix server ip

[root@oatest zabbix-3.0.3] # ln-s / usr/local/zabbix/sbin/* / usr/sbin/

[root@oatest zabbix-3.0.3] # cp misc/init.d/fedora/core/zabbix_* / etc/init.d/

[root@oatest zabbix-3.0.3] # chmod + x / etc/init.d/zabbix_*

[root@oatest zabbix-3.0.3] # sed-I "s@BASEDIR=/usr/local@BASEDIR=/usr/local/zabbix@g" / etc/init.d/zabbix_server

[root@oatest zabbix-3.0.3] # vi / etc/httpd/conf/httpd.conf

ServerName 127.0.0.1

ServerName 192.168.30.173

DocumentRoot "/ var/www/html"

[root@oatest zabbix-3.0.3] # mkdir-p / var/www/html/zabbix

[root@oatest zabbix-3.0.3] # cp-r frontends/php/* / var/www/html/zabbix/

[root@oatest zabbix-3.0.3] # chown-R apache.apache / var/www/html/zabbix/

[root@oatest zabbix-3.0.3] # chkconfig zabbix_server on

[root@oatest zabbix-3.0.3] # service zabbix_server start

[root@oatest zabbix-3.0.3] # service httpd restart

Compile php if you re-make and make install after make clean, you need to reconfigure / usr/local/php/lib/php.ini

6. WEB page configuration of zabbix

Http://IP/zabbix/setup.php

Login user / password Admin/zabbix

There will be a prompt when you encounter an error, such as PHP bcmath extension missing (PHP configuration parameter-- enable-bcmath)

Solution: re-make and make install after make clean to compile php, plus the parameter-- enable-bcmath

The solution to the following error is encountered

First install jpeg and freetype and then make clean, then re-make and make install to compile php, plus the parameter-- with-jpeg-dir-- with-freetype-dir

PHP gd JPEG image support missing.

PHP gd FreeType support missing.

JPEG download address http://www.ijg.org/files/jpegsrc.v9b.tar.gz

FreeType download address https://sourceforge.net/projects/freetype/files/freetype2/2.6.5/freetype-2.6.5.tar.gz/download

[root@oatest zabbix-3.0.3] # cd / u01/software/

[root@oatest software] # tar-zxvf jpegsrc.v9b.tar.gz

[root@oatest software] # cd jpeg-9b/

[root@oatest jpeg-9b] # mkdir / usr/local/freetype

[root@oatest jpeg-9b] # / configure-- prefix=/usr/local/jpeg-- enable-shared

[root@oatest jpeg-9b] # make

[root@oatest jpeg-9b] # make install

[root@oatest jpeg-9b] # cd / u01/software/

[root@oatest software] # tar-zxvf freetype-2.6.5.tar.gz

[root@oatest software] # cd freetype-2.6.5

[root@oatest freetype-2.6.5] # mkdir / usr/local/freetype

[root@oatest freetype-2.6.5] #. / configure-prefix=/usr/local/freetype/

[root@oatest freetype-2.6.5] # make

[root@oatest freetype-2.6.5] # make install

[root@oatest freetype-2.6.5] # cd / u01/software/php-5.6.13

[root@oatest php-5.6.13] # / configure-- prefix=/usr/local/php-- with-apxs2=/usr/sbin/apxs-- with-mysqli-- enable-bcmath-- enable-mbstring-- enable-sockets-- with-gd-- with-jpeg-dir-- with-freetype-dir

[root@oatest php-5.6.13] # make clean

-- you must clear the original compiled configuration and recompile php

[root@oatest php-5.6.13] # make

[root@oatest php-5.6.13] # make install

[root@oatest php-5.6.13] # cp php.ini-development / usr/local/php/lib/php.ini

[root@oatest php-5.6.13] # vi / usr/local/php/lib/php.ini

Add the following

Date.timezone = Asia/Shanghai

Post_max_size = 32m

Max_execution_time = 300

Max_input_time = 300

Always_populate_raw_post_data =-1

When Configure DB connection reports an error as follows

Error connecting to database: No such file or directory

Ln-s / var/lib/mysql/mysql.sock / tmp/

Add a line for vi / usr/local/php/lib/php.ini, as follows:

Mysqli.default_socket = / var/lib/mysql/mysql.sock

[root@oatest php-5.6.13] # service httpd restart

ZABBIX client installation

Method 1: use the source file, that is, configure is required

When installing the client, the package and the server are the same, except that the configuration parameters of configure are different.

Useradd zabbix

Tar-zxvf zabbix-3.0.3.tar.gz

Cd zabbix-3.0.3

. / configure-- prefix=/usr-- sysconfdir=/etc/zabbix-- enable-agent

Make

Make install

Mkdir / var/log/zabbix

Chown zabbix.zabbix / var/log/zabbix

Cp misc/init.d/fedora/core/zabbix_agentd / etc/init.d/

Chmod 755 / etc/init.d/zabbix_agentd

Sed-I "s#BASEDIR=/usr/local#BASEDIR=/usr/#g" / etc/init.d/zabbix_agentd

Add zabbix to the system service file

Vi / etc/services

Zabbix-agent 10050/tcp # ZabbixAgent

Zabbix-agent 10050/udp # ZabbixAgent

Zabbix-trapper 10051/tcp # ZabbixTrapper

Zabbix-trapper 10051/udp # ZabbixTrapper

Vi / etc/zabbix/zabbix_agentd.conf

Modify Server, ServerActive, and Hostname

Service zabbix_agentd start

The server executes as follows, and the value is returned.

/ usr/local/zabbix/bin/zabbix_get-s client IP-p 10050-k "system.uptime"

Method 2: use binaries directly

1.tar-zxvf zabbix_agents_2.4.0.linux2_6.amd64.tar.gz

2.mkdir / etc/zabbix/

3.mv bin/zabbix_get / usr/bin/

4.mv bin/zabbix_sender / usr/bin/

5.mv sbin/zabbix_agent / usr/bin/

6.mv sbin/zabbix_agentd / usr/bin/

7.mv conf/zabbix_agentd.conf / etc/zabbix/

8. Modify zabbix_agentd.conf

Hostname=zabbix-client1 # # the hostname here should be the same as the client's hostname and the name in the monitoring host!

ServerActive=192.168.254.153 # ip of zabbix server

Ip of Server=192.168.254.153####zabbix server

9.groupadd-r zabbix

Useradd-g zabbix-s / sbin/nologin zabbix

10.zabbix_agentd-c / etc/zabbix/zabbix_agentd.conf # specify configuration file startup

11.ps-ef | grep zabbix

Lsof-iPlus 10050

After reading the above, have you mastered how to install and configure zabbix? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report