一、版本说明:
php:php-5.6.31
mysql:5.6.30
zabbix:zabbix-2.4.8
nginx:nginx-1.10.3
二、安装
2.1、安装php
1)下载:
链接:
编译安装:
-
[root@iZwz9ijiwzg03dd12i6sfmZ software]# wget http://am1.php.net/distributions/php-5.6.31.tar.gz
-
[root@iZwz9ijiwzg03dd12i6sfmZ software]# tar -zxf php-5.6.31.tar.gz
-
[root@iZwz9ijiwzg03dd12i6sfmZ software]# cd php-5.6.31
-
[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
-
[root@iZwz9ijiwzg03dd12i6sfmZ php-5.6.31]# make ZEND_EXTRA_LIBS='-liconv' #make报undefined reference to `libiconv_open 无法编译 PHP libiconviconv的时候可以这样。
-
[root@iZwz9ijiwzg03dd12i6sfmZ php-5.6.31]# make install
-
[root@iZwz9ijiwzg03dd12i6sfmZ php-5.6.31]#cp php.ini-production /usr/local/php/etc/php.ini
-
[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源
-
[root@P2pTest ~]# mkdir -p /srv/software
-
[root@P2pTest ~]# cd /srv/software
-
[root@P2pTest software] yum install wget gcc unzip gcc-c++ -y
-
[root@P2pTest software]
-
wget https://repo.mysql.com//mysql57-community-release-el6-11.noarch.rpm
-
[root@P2pTest software] rpm -Uvh mysql57-community-release-el6-11.noarch.rpm
2)启用mysql5.6的yum源,禁用5.7的yum源。
-
[root@P2pTest software]vi /etc/yum.repos.d/mysql-community.repo
-
[mysql57-community]
-
name=MySQL 5.7 Community Server
-
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/6/$basearch/
-
enabled=0
-
gpgcheck=1
-
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
-
-
# Enable to use MySQL 5.6
-
[mysql56-community]
-
name=MySQL 5.6 Community Server
-
baseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/6/$basearch/
-
enabled=1
-
gpgcheck=1
-
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
查询mysql 5.6的 yum源是否可用:
-
[root@P2pTest software]# yum repolist enabled|grep mysql
-
mysql-connectors-community MySQL Connectors Community 42
-
mysql-tools-community MySQL Tools Community 51
-
mysql56-community MySQL 5.6 Community Server 377 #可用
4)初始化mysql用户: root/Ulife@2017
-
[root@P2pTest software]# yum install mysql-community-server mysql-devel -y
-
[root@P2pTest software]# service mysqld start
-
[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;
}
}
阅读(1962) | 评论(0) | 转发(0) |