Chinaunix首页 | 论坛 | 博客
  • 博客访问: 115129
  • 博文数量: 28
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 277
  • 用 户 组: 普通用户
  • 注册时间: 2014-10-20 16:21
文章分类
文章存档

2019年(1)

2018年(2)

2017年(22)

2016年(3)

我的朋友

分类: 系统运维

2017-10-20 11:54:47

一、版本说明:

php:php-5.6.31
mysql:5.6.30
zabbix:zabbix-2.4.8

nginx:nginx-1.10.3

二、安装

2.1、安装php

1)下载:
链接:
编译安装:

点击(此处)折叠或打开

  1. [root@iZwz9ijiwzg03dd12i6sfmZ software]# wget http://am1.php.net/distributions/php-5.6.31.tar.gz
  2. [root@iZwz9ijiwzg03dd12i6sfmZ software]# tar -zxf php-5.6.31.tar.gz
  3. [root@iZwz9ijiwzg03dd12i6sfmZ software]# cd php-5.6.31
  4. [root@iZwz9ijiwzg03dd12i6sfmZ php-5.6.31]# ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-bz2 --enable-sockets --with-gd --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-freetype-dir=/usr/local --enable-gd-native-ttf --with-iconv-dir=/usr/local --enable-mbstring --with-gettext --with-libxml-dir=/usr/local --with-zlib --with-mysql=mysqlnd --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --enable-dom --enable-xml --enable-fpm --enable-bcmath
  5. [root@iZwz9ijiwzg03dd12i6sfmZ php-5.6.31]# make ZEND_EXTRA_LIBS='-liconv'         #make报undefined reference to `libiconv_open 无法编译 PHP                                                                                   libiconviconv的时候可以这样。
  6. [root@iZwz9ijiwzg03dd12i6sfmZ php-5.6.31]# make install
  7. [root@iZwz9ijiwzg03dd12i6sfmZ php-5.6.31]#cp php.ini-production /usr/local/php/etc/php.ini
  8. [root@iZwz9ijiwzg03dd12i6sfmZ php-5.6.31]#cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
修改php.ini的配置参数:
max_execution_time = 300
memory_limit = 128M
post_max_size = 16M
upload_max_filesize = 2M
max_input_time = 300
date.timezone = Asia
always_populate_raw_post_data = -1

2.2、安装mysql

1) yum安装mysql。
安装mysql的yum源

点击(此处)折叠或打开

  1. [root@P2pTest ~]# mkdir -p /srv/software
  2. [root@P2pTest ~]# cd /srv/software
  3. [root@P2pTest software] yum install wget gcc unzip gcc-c++ -y
  4. [root@P2pTest software]
  5. wget https://repo.mysql.com//mysql57-community-release-el6-11.noarch.rpm
  6. [root@P2pTest software] rpm -Uvh mysql57-community-release-el6-11.noarch.rpm

2)启用mysql5.6的yum源,禁用5.7的yum源。

点击(此处)折叠或打开

  1. [root@P2pTest software]vi /etc/yum.repos.d/mysql-community.repo
  2. [mysql57-community]
  3. name=MySQL 5.7 Community Server
  4. baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/6/$basearch/
  5. enabled=0
  6. gpgcheck=1
  7. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

  8. # Enable to use MySQL 5.6
  9. [mysql56-community]
  10. name=MySQL 5.6 Community Server
  11. baseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/6/$basearch/
  12. enabled=1
  13. gpgcheck=1
  14. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
查询mysql 5.6的 yum源是否可用:

点击(此处)折叠或打开

  1. [root@P2pTest software]# yum repolist enabled|grep mysql
  2. mysql-connectors-community     MySQL Connectors Community      42
  3. mysql-tools-community          MySQL Tools Community           51
  4. mysql56-community              MySQL 5.6 Community Server      377 #可用

4)初始化mysql用户: root/Ulife@2017

点击(此处)折叠或打开

  1. [root@P2pTest software]# yum install mysql-community-server mysql-devel -y
  2. [root@P2pTest software]# service mysqld start
  3. [root@P2pTest software]# mysqladmin -uroot password "Ulife@2017"
2.3、安装zabbix

1)下载:
%20Latest%20Stable/2.4.8/zabbix-2.4.8.tar.gz
编译安装:
./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2 --prefix=/srv/zabbix
make && make install
useradd -M -s /sbin/nologin zabbix

2)创建zabbix库,zabbix用户。
mysql> create database zabbix default charset utf8;
mysql>grant all on zabbix.* to 'zabbix'@'127.0.0.1' identified by "zabbix";
mysql>flush privileges;
将解压目录的database/mysql/中的sql导入zabbix库

3)修改zabbix_server.conf文件以下内容:
DBName=zabbix
DBUser=root
DBPassword=ttlsapwd
DBPort=3306

4)启动zabbix:
/srv/zabbix/sbin/zabbix_server


2.4、安装nginx

1)安装zlib
cd /srv/software
wget
tar -zxf zlib-1.2.11.tar.gz
cd zlib-1.2.11
./configure
make&&make install

2)安装pcre
cd /srv/software
wget
tar -zxf pcre-8.40.tar.gz
cd pcre-8.40
./configure
make&& make install

3)安装nginx
yum install openssl-devel -y
cd /srv/software
mkdir -p /srv/nginx
wget
tar -zxf nginx-1.10.3.tar.gz
cd nginx-1.10.3
./configure --prefix=/srv/nginx --with-pcre=/srv/software/pcre-8.40 --with-zlib=/srv/software/zlib-1.2.11 --with-stream_ssl_module --with-stream --with-http_ssl_module --with-poll_module
make && make install 


4)修改配置文件 /srv/nginx/conf/nginx.conf
加入以下server
server {
        listen       80;
        server_name yourserverIP
        access_log  /var/log/nginx/zabbix.access.log  main;
 
        index index.html index.php index.html;
        root /var/www/zabbix;
 
        location /
        {
                try_files $uri $uri/ /index.php?$args;
        }
 
        location ~ ^(.+.php)(.*)$ {
                fastcgi_split_path_info ^(.+.php)(.*)$;
                include fastcgi.conf;
                fastcgi_pass  127.0.0.1:9000;
                fastcgi_index index.php;
                fastcgi_param  PATH_INFO          $fastcgi_path_info;
        }
}

阅读(1957) | 评论(0) | 转发(0) |
0

上一篇:bash陷阱

下一篇:zabbix2.4.8 配置sendEmail告警

给主人留下些什么吧!~~