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

Zabbix3.0 LNMP installation and deployment

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

Preparation before installation: 1.1 description of the running environment of this instance:

Operating system version: CentOS 7

First of all, we need to build the Zabbix running environment: LNMP (Linux + nginx+ MySQL + PHP)

CentOS 7

Ningx 1.9.10

Php7

Mysql 5.6

1.2 download the installation package

1.2.1 update address of the installation package on the official website:

Http://www.zabbix.com/download.php

2.2 3.0 download:

Cd / usr/local/src

Wget http://jaist.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.0.0/zabbix-3.0.0.tar.gz

2.3 install dependency packages:

Yum install net-snmp-devel OpenIPMI-developenssl-devel fping-devel libcurl-devel perl-DBI gcc

2.4 add zabbix users

Useradd-d / usr/local/zabbix-3.0.0/lib/zabbix-s / sbin/nologin zabbix

two。 Install and configure 2.1 source package compilation and installation

Cd / usr/local/src

Tar xzvf zabbix-3.0.0.tar.gz

Cd zabbix-3.0.0

Cd. / configure-prefix=/usr/local/zabbix--enable-server-enable-agent-with-mysql-enable-ipv6-with-net-snmp--with-libcurl-with-libxml2

Make install

2.2 configure zabbix program directory ownership

Chown-R zabbix.zabbix / usr/local/zabbix

2.3 add Port

Vim / etc/services

Zabbix-agent 10050/tcp # Zabbix Agent

Zabbix-agent 10050/udp # Zabbix Agent

Zabbix-trapper 10051/tcp # Zabbix Trapper

Zabbix-trapper 10051/udp # Zabbix Trapper

2.4 Establishment of database and structure import

Start mysql:

Service mysqld start

Mysql-uroot-p

Set up the zabbix database:

Mysql > create database zabbix characterset utf8 collate utf8_bin

Mysql > grant all on zabbix.* to'zabbix'@'127.0.0.1' identified by '123' with grant option

# mariadb database usage: mysql > grant all privileges on zabbix.* tozabbix@localhost identified by 'zabbix'

Mysql > source/usr/local/src/zabbix-3.0.0/

Mysql > flush privileges

Mysql > exit

Import sql scripts from the zabbix source directory:

Mysql-uroot-p password zabbix

< /usr/local/src/zabbix-3.0.0/database/mysql/schema.sql mysql -uroot -p密码 zabbix < /usr/local/src/zabbix-3.0.0/database/mysql/data.sql mysql -uroot -p密码 zabbix < /usr/local/src/zabbix-3.0.0/database/mysql/p_w_picpaths.sql 2.5修改zabbix配置文件 cd /usr/local/zabbix/etc vi /usr/local/zabbix/etc/zabbix_server.conf DBName=zabbix #数据库名称 DBUser=zabbix #数据库用户名 DBPassword=123456 #数据库密码 ListenIP=127.0.0.1 #数据库ip地址 2.6添加zabbix服务启动及开机启动 2.6.1从源码目录复制启动脚本到/etc/init.d/ cp /usr/local/src/zabbix-3.0.0/misc/init.d/fedora/core5/zabbix_server /etc/init.d/ cp /usr/local/src/zabbix-3.0.0/misc/init.d/fedora/core5/zabbix_agend /etc/init.d/ 2.6.2设置运行权限 chmod 700 /etc/init.d/zabbix_* 2.6.3修改启动脚本程序目录正确路径 vim/etc/init.d/zabbix_server 修改: ZABBIX_BIN="/usr/local/sbin/zabbix_server" 为: ZABBIX_BIN="/usr/local/srcx/sbin/zabbix_server" vim/etc/init.d/zabbix_agentd 修改: ZABBIX_BIN="/usr/local/sbin/zabbix_agentd" 为: ZABBIX_BIN="/usr/local/src/sbin/zabbix_agentd" 2.6.4启动服务并设置开机启动 /etc/init.d/zabbix_server start /etc/init.d/zabbix_agentd start 2.6.5设置开机启动 chkconfig -level 2345 zabbix_server on chkconfig -level 2345 zabbix_agentd on 3. zabbix web 管理界面配置3.1 部署web 目录 3.1.1从解压目录拷贝web代码 cp -rf /usr/local/src/zabbix-3.0.0/frontends/php /data/wwwroot/zabbix 代码目录 zabbix web 项目目录 3.1.2配置web目录权限归属为nginx运行用户www Chown -R www:www /data/wwwroot/zabbix 3.2 php配置 3.2.1修改php/etc/php-fpm.d/www.conf.default或/etc/php.ini,下面值是最低要求: php_value max_execution_time 300 php_value memory_limit 128M php_value post_max_size 16M php_value upload_max_filesize 2M php_value max_input_time 300 # php_value date.timezone Europe/Riga 3.2.2修改php.ini vim /usr/local/php/etc/php.ini ----------------------------------------->

Date.timezone = Asia/Shanghai

Post_max_size = 16m

Max_execution_time = 300

Max_input_time = 300

3.2.3 start php-fpm

Service php-fpm start

3.3 modify the nginx configuration file

Vi/usr/local/nginx/conf/vhost/zabbix.test.com.conf

Enter:

Server {

Listen 80

Server_name zabbix.test.com; # access domain name

Access_log/data/wwwlogs/zabbix/zabbix.test.com_nginx.log combined

Index index.html index.htm index.php

Include / usr/local/nginx/conf/none.conf

Root/ data/wwwroot/zabbix; # web root directory

Location ~ [^ /]\ .php (/ | $) {

# fastcgi_pass remote_php_ip:9000

Fastcgi_passunix:/dev/shm/php-cgi.sock

Fastcgi_index index.php

Include fastcgi.conf

}

Location ~. *\. (gif | jpg | jpeg | png | bmp | swf | flv | ico) ${

Expires 30d

Access_log off

}

Location. *\. (js | css)? ${

Expires 7d

Access_log off

}

}

Start nginx

Service nginx start

3.4 web interface configuration

Open the domain name link http://zabbix.test.com/setup.php configured by nginx and configure it as follows:

LNMP platform php7, problems that may occur in zabbix installation always-populate-raw-post-data =-1, solution:

Vim / directory / zabbix/include/classes/setup/CFrontendSetup.php, find the following code, about always-populate-raw-post-data

Add $current =-1

Public functioncheckPhpAlwaysPopulateRawPostData () {

$current = ini_get ('always_populate_raw_post_data')

$current =-1

Return array (

'name' = > _ (' PHPalways_populate_raw_post_data')

'current' = > ($current! =-1)? _ (' on'): _ ('off')

'required' = > _ (' off')

'result' = > ($current! =-1)? Self::CHECK_FATAL: self::CHECK_OK

'error' = > _ ('PHPalways_populate_raw_post_data must be set to-1.')

);

}

Go back to the page refresh, normal:

Enter the database address to connect to and the name of the zabbix database:

But by default, the next step:

To display a confirmation message, next:

Indicates that the installation was successful:

Enter the default user: Admin, password: zabbi, click "Sign in" to log in and enter the zabbix interface:

After login page:

At this point, the zabbix installation is complete.

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

Database

Wechat

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

12
Report