Centos 6.5 System LNMP Environment build zabbix2.4

Source: Internet
Author: User
Tags install openssl snmp

1. Compile and install Nginx
1) Compile and install Pcre.
Nginx installation requires PCRE support.
[Email protected] ~]# mkdir-p/taokey/tools
[Email protected] ~]# cd/taokey/tools/
[email protected] tools]# Yum install-y gcc gcc-c++
[Email protected] tools]# TAR-ZXF pcre-8.33.tar.gz
[Email protected] tools]# CD pcre-8.33
[Email protected] pcre-8.33]#./configure
[[email protected] pcre-8.33]# make && make install
[Email protected] pcre-8.33]# CD.
1) Create an nginx normal user.
[Email protected] ~]# useradd nginx-s/sbin/nologin-m
2) Download and unzip the Nginx source package.
[Email protected] tools]# wget http://nginx.org/download/nginx-1.6.3.tar.gz
[Email protected] tools]# TAR-ZXF nginx-1.6.3.tar.gz
[Email protected] tools]# CD nginx-1.6.3
[Email protected] nginx-1.6.3]# yum-y install OpenSSL openssl-devel
3) Compile and install Nginx.
[Email protected] nginx-1.6.3]#/configure--user=nginx--group=nginx--prefix=/usr/local/nginx--with-http_stub_ Status_module--with-http_ssl_module
[[email protected] nginx-1.6.3]# make && make install
4) Start Nginx.
[Email protected] nginx-1.6.3]# Echo/usr/local/lib >>/etc/ld.so.conf
[Email protected] nginx-1.6.3]# Ldconfig
[Email protected] nginx-1.6.3]#/usr/local/nginx/sbin/nginx-t
Nginx:the configuration file/usr/local/nginx/conf/nginx.conf syntax is OK
Nginx:configuration file/usr/local/nginx/conf/nginx.conf Test is successful
[Email protected] nginx-1.6.3]#/usr/local/nginx/sbin/nginx
[Email protected] nginx-1.6.3]# Ps-ef | grep nginx
Root 11456 1 0 14:39? 00:00:00 Nginx:master Process/usr/local/nginx/sbin/nginx
Nginx 11457 11456 0 14:39? 00:00:00 Nginx:worker Process
Root 11459 1794 0 14:39 pts/1 00:00:00 grep nginx
2.yum installing MySQL
[email protected] ~]# yum install-y mysql-server mysql-devel MySQL
[[email protected] ~]#/etc/init.d/mysqld start
[Email protected] ~]# Ps-ef | grep MySQL
Root 11567 1 0 14:41 pts/1 00:00:00/bin/sh/usr/bin/mysqld_safe--datadir=/var/lib/mysql--socket=/var/lib/my Sql/mysql.sock--pid-file=/var/run/mysqld/mysqld.pid--basedir=/usr--user=mysql
MySQL 11669 11567 1 14:41 pts/1 00:00:00/usr/libexec/mysqld--basedir=/usr--datadir=/var/lib/mysql- -log-error=/var/log/mysqld.log--pid-file=/var/run/mysqld/mysqld.pid--socket=/var/lib/mysql/mysql.sock
Root 11693 1794 0 14:42 pts/1 00:00:00 grep mysql
[Email protected] ~]# NETSTAT-ANPT | grep 3306
TCP 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 11669/mysqld
3.yum install PHP.
[email protected] ~]# yum install-y php php-mysql php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc Php-mbstring php-mcrypt php-bcmath php-mhash libmcrypt libmcrypt-devel php-fpm php-pecl*
[Email protected] ~]# sed-i ' s/^user =.*/user = nginx/g '/etc/php-fpm.d/www.conf
[Email protected] ~]# sed-i ' s/^group =.*/group = nginx/g '/etc/php-fpm.d/www.conf
[[email protected] ~]#/etc/init.d/php-fpm start
Starting php-fpm:[OK]
[Email protected] ~]# Ps-ef | grep php
Root 11746 1 0 14:45? 00:00:00 Php-fpm:master Process (/etc/php-fpm.conf)
Nginx 11747 11746 0 14:45? 00:00:00 Php-fpm:pool www
Nginx 11748 11746 0 14:45? 00:00:00 Php-fpm:pool www
Nginx 11749 11746 0 14:45? 00:00:00 Php-fpm:pool www
Nginx 11750 11746 0 14:45? 00:00:00 Php-fpm:pool www
Nginx 11751 11746 0 14:45? 00:00:00 Php-fpm:pool www
Root 11754 1794 0 14:45 pts/1 00:00:00 grep php
4. Configure Nginx, combined with PHP environment,
Vi/usr/local/nginx/conf/nginx.conf
server {
Listen 80;
server_name localhost;
Location/{
root HTML;
Index index.html index.htm index.php;
}
Location ~ \.php$ {
root HTML;
Fastcgi_pass 127.0.0.1:9000;
Fastcgi_index index.php;
Fastcgi_param script_filename $document _root$fastcgi_script_name;
Include Fastcgi_params;
Include fastcgi.conf;
}
}
[Email protected] ~]#/usr/local/nginx/sbin/nginx-t
Nginx:the configuration file/usr/local/nginx/conf/nginx.conf syntax is OK
Nginx:configuration file/usr/local/nginx/conf/nginx.conf Test is successful
[Email protected] ~]#/usr/local/nginx/sbin/nginx-s Reload
5. Test to see if the PHP environment is working properly.
[email protected] ~]# cat >/usr/local/nginx/html/index.php <<eof
<?php
Phpinfo ();
?>
Eof
6. Install the Zabbix server-side package.
1) Install the appropriate libraries and packages, and create Zabbix users.
[Email protected] ~]# yum-y install Libcurl-devel net-snmp-devel
[Email protected] ~]# useradd zabbix-s/sbin/nologin
2. Download Zabbix source package, compile and install Zabbix
[Email protected] tools]# TAR-ZXF zabbix-2.4.0.tar.gz
[Email protected] tools]# CD zabbix-2.4.0
[Email protected] zabbix-2.4.0]#/configure--prefix=/usr/local/zabbix--enable-server--enable-agent--with-mysql- -with-net-snmp--with-libcurl
[[email protected] zabbix-2.4.0]# make install
7. Create the required database for Zabbix in MySQL and the account password;
[[email protected] zabbix-2.4.0]# MySQL
Welcome to the MySQL Monitor. Commands End With; or \g.
Your MySQL Connection ID is 2
Server version:5.1.73 Source Distribution

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

Oracle is a registered trademark of the Oracle Corporation and/or its
Affiliates. Other names 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 [email protected] '% ' identified by ' Zabbix ';
Query OK, 0 rows affected (0.01 sec)

Mysql> Delete from Mysql.user where user= "";
Query OK, 2 rows Affected (0.00 sec)

mysql> flush Privileges;
Query OK, 0 rows Affected (0.00 sec)
8.zabbix data import creates a good Zabbix database.
[Email protected] zabbix-2.4.0]# mysql-uzabbix-pzabbix-h127.0.0.1 Zabbix < Database/mysql/schema.sql
[Email protected] zabbix-2.4.0]# mysql-uzabbix-pzabbix-h127.0.0.1 Zabbix < Database/mysql/images.sql
[Email protected] zabbix-2.4.0]# mysql-uzabbix-pzabbix-h127.0.0.1 Zabbix < Database/mysql/data.sql
9. Copy the boot files of the Zabbix server and client.
[email protected] zabbix-2.4.0]# CP misc/init.d/fedora/core/zabbix_server/etc/init.d/
[email protected] zabbix-2.4.0]# CP misc/init.d/fedora/core/zabbix_agentd/etc/init.d/
10. Modifying configuration files and startup files
[Email protected] zabbix-2.4.0]# sed-i ' s/^dbuser=.*$/dbuser=zabbix/g '/usr/local/zabbix/etc/zabbix_server.conf
[Email protected] zabbix-2.4.0]# sed-i ' s/^.*dbpassword=.*$/dbpassword=zabbix/g '/usr/local/zabbix/etc/zabbix_ Server.conf
[Email protected] zabbix-2.4.0]# sed-i ' s/^.*dbhost=.*$/dbhost=127.0.0.1/g '/usr/local/zabbix/etc/zabbix_ Server.conf
[Email protected] zabbix-2.4.0]# sed-i ' s/basedir=\/usr\/local/basedir=\/usr\/local\/zabbix/g '/etc/init.d/zabbix_ Server
[Email protected] zabbix-2.4.0]# sed-i ' s/basedir=\/usr\/local/basedir=\/usr\/local\/zabbix/g '/etc/init.d/zabbix_ Agentd
11. In the/etc/services file, add the Zabbix service port
[email protected] zabbix-2.4.0]# cat >>/etc/services <<eof
> zabbix-agent 10050/tcp Zabbix Agent
> zabbix-agent 10050/udp Zabbix Agent
> Zabbix-trapper 10051/tcp Zabbix Trapper
> Zabbix-trapper 10051/udp Zabbix Trapper
> EOF
[Email protected] zabbix-2.4.0]# tail-4/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
12. Copy the Zabbix program file to the specified web directory of Nginx and set the appropriate permissions
[Email protected] zabbix-2.4.0]# Cp-ra frontends/php//usr/local/nginx/html/zabbix
[Email protected] zabbix-2.4.0]# chown-r Nginx.nginx/usr/local/nginx/html/zabbix
13. Start the Zabbix server and the Zabix agent.
[[email protected] zabbix-2.4.0]#/etc/init.d/zabbix_server start
[[email protected] zabbix-2.4.0]#/etc/init.d/zabbix_agentd start
[Email protected] zabbix-2.4.0]# NETSTAT-ANPT | grep 10050
TCP 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN 19850/zabbix_agentd
[Email protected] zabbix-2.4.0]# NETSTAT-ANPT | grep 10051
TCP 0 0 0.0.0.0:10051 0.0.0.0:* LISTEN 19786/zabbix_server
TCP 0 0 127.0.0.1:10051 127.0.0.1:37229 time_wait-
14. Enter in the browser: http://192.168.1.40/zabbix/setup.php Install the Zabbix Server Web interface.


15. Modify the PHP configuration to meet the Zabbix installation requirements.
[Email protected] zabbix-2.4.0]# sed-i ' s/^\ (. *\) Date.timezone =.*$/date.timezone = asia\/shanghai/g '/etc/php.ini
[Email protected] zabbix-2.4.0]# sed-i ' s/^\ (. *\) post_max_size =.*$/post_max_size = 16m/g '/etc/php.ini
[Email protected] zabbix-2.4.0]# sed-i ' s/^\ (. *\) Max_execution_time =.*$/max_execution_time = 300/g '/etc/php.ini
[Email protected] zabbix-2.4.0]# sed-i ' s/^\ (. *\) Max_input_time =.*$/max_input_time = 300/g '/etc/php.ini
[Email protected] zabbix-2.4.0]#/etc/init.d/php-fpm restart
Stop php-fpm:[OK]
Starting php-fpm:[OK]

This article is from the creator think blog, so be sure to keep this source http://strongit.blog.51cto.com/10020534/1638110

Centos 6.5 System LNMP Environment build zabbix2.4

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.