测试环境搭建之centos系统编译安装nginx+php环境另加独立mysql
来源:互联网 发布:360网络流量监控软件 编辑:程序博客网 时间:2024/05/22 21:22
centos系统编译安装nginx+php环境另加独立mysql教程
前端(nginx+php)ip:192.168.10.8
后端(独立mysql)ip:192.168.10.5
软件版本:libiconv-1.14.tar.gz mysql-5.1.63.tar.gz php-5.2.17.tar.gz php-5.2.17-fpm-0.5.14.diff.gz php-5.2.17-max-input-vars.patch
1.先在后端安装mysql
在192.168.10.5上只安装mysql.方法可以去看centos编译安装nginx+php-fpm+mysql里的mysql安装.
2.在前端安装php-fpm nginx和mysql-client
这里只说下安装mysql-client和php的编译安装.
代码如下复制代码tar zxf mysql-5.1.63.tar.gz && cd mysql-5.1.63./configure --prefix=/usr/local/mysql --without-server
这里只需要加上--without-server就可以让mysql变成客户端了.
如果出现/bin/rm: cannot remove `libtoolt': No such file or directory,可以去看这篇文章Mysql安装:/bin/rm: cannot remove `libtoolt': No such file or directory.
没有问题后,执行命令:
编译php的时候只需要加上--with-mysql=mysql客户端安装目录就可以了.这里我给出编译参数:
代码如下复制代码./configure --prefix=/usr/local/php --enable-fastcgi --enable-fpm --with-fpm-log=/var/log/php-fpm.log \--with-fpm-conf=/etc/php-fpm.conf --with-fpm-pid=/var/run/php-fpm.pid --with-config-file-path=/etc \
--with-config-file-scan-dir=/etc/php.d --with-openssl --with-zlib --enable-bcmath --with-bz2 --with-curl \
--enable-ftp --with-gd --enable-gd-native-ttf --with-jpeg-dir --with-png-dir --with-gettext --with-mhash \
--enable-mbstring --with-mcrypt --enable-soap --enable-zip --with-iconv=/usr/local/libiconv \
--with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --without-pear
nginx的编译没有什么好说的了,我前面centos编译安装nginx+php-fpm+mysql这篇文章里已经有讲过了.
3.进行测试验证
当上面的一切都安装好之后,在后端的mysql里给出远程权限,如下:
然后iptables上只允许192.168.10.8访问mysql端口,其他都拒绝.如:
代码如下复制代码iptables -A RH-Firewall-1-INPUT -s 192.168.10.8 -p tcp -m tcp --dport 3306 -j ACCEPTiptables -A RH-Firewall-1-INPUT -p tcp --dport 3306 -j DROP
services iptables save
services iptables restart
然后在192.168.10.8上进行测试,是否可以远程连上mysql
mysql -h 192.168.10.5 -u root -p
如果可以连上,就继续下一步的操作,不能连上的话请检查上面是否有错误的地方.
现在我们加个php页面来测试php是否可以连上mysql,脚本如下:
代码如下复制代码<?php$link=mysql_connect("192.168.10.5","root","123456");
if(!$link) echo "bad!" ;
else echo "ok!" ;
mysql_close();
?>
成功的话是ok!的输出,失败的话是bad!的输出,我这里是成功的
mysql 5.5.x的只安装客户端.
需要的软件:libiconv-1.14.tar.gz mysql-5.5.25a.tar.gz
1.安装前的准备
安装前的准备,可以去看这篇文章centos编译安装nginx+php-fpm+mysql
2.安装libiconv
代码如下复制代码./configure --prefix=/usr/local/libiconvmake && make install
3.只安装mysql客户端
代码如下复制代码cmake . && make mysqlclient libmysqlmake install
这样就只安装了mysql客户端,然后可以输入whereis mysql来查看mysql安装位置.
whereis mysql
好了,可以看到跟yum安装的差不多.
4.安装php
以前mysql是5.1的时候,只需要加上--with-mysql=mysql客户端安装目录就可以了,但在mysql 5.5.x这个参数就要改变下了,下面是php的编译参数:
--with-fpm-pid=/var/run/php-fpm.pid --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d \
--with-openssl --with-zlib --enable-bcmath --with-bz2 --with-curl --enable-ftp \
--with-gd --enable-gd-native-ttf --with-jpeg-dir --with-png-dir --with-gettext --with-mhash \
--enable-mbstring --with-mcrypt --enable-soap --enable-zip --with-iconv=/usr/local/libiconv \
--with-mysql=shared,/usr --with-mysqli=shared,/usr/bin/mysql_config
大家可以看最后一行,--with-mysql=shared,/usr --with-mysqli=shared,/usr/bin/mysql_config这就是跟以前不同的行.好了,剩下的就不写了
- 测试环境搭建之centos系统编译安装nginx+php环境另加独立mysql
- centos + nginx + mysql + php 环境编译安装
- Linux\CentOS系统下的服务器搭建,下载编译环境,安装vsFtpd、nginx、MySQL、JDK、Tomcat、PHP
- Linux\CentOS系统下的服务器搭建,下载编译环境,安装vsFtpd、nginx、MySQL、JDK、Tomcat、PHP
- centos环境下编译安装nginx+php搭建
- CentOS 7 上编译安装Nginx,搭建PHP运行环境。
- Centos 编译安装LNMP环境(Nginx+MySQL+PHP)教程
- 在CentOS 7下编译安装Nginx+PHP+MySQL环境
- CentOS + Nginx + PHP + MySQL 环境搭建
- centos yum搭建nginx php mysql 环境
- centos php+mysql+nginx基础环境搭建
- 源码编译安装,搭建LNMP环境(Linux+Nginx+MySQL+PHP)
- 测试环境搭建之centos系统给php安装php-memcached模块
- centos下安装nginx+mysql+php环境
- CentOs 系统安装Apache+Mysql+php环境
- centos安装php环境 (mysql,nginx,php,php-fpm)
- Linux---CentOS搭建环境之安装Mysql
- CentOS+Nginx+PHP+Mysql+安全指南全环境搭建笔记
- 测试环境搭建之CentOS 7.0系统安装配置步骤详解
- 奇偶校验、CRC校验、海明码校验
- perl 获取虚拟机信息
- JavaScript之接口实现
- Tomcat部署Java和php相结合的项目
- 测试环境搭建之centos系统编译安装nginx+php环境另加独立mysql
- VXLAN 概念(Part II)- 每天5分钟玩转 OpenStack(109)
- okhttp使用详解和原理
- Latex文件输出之02向自己的文本文件中输出内容
- Installing vSphere SDK for Perl
- Tomcat直接部署PHP项目
- csv读入数据,用julia/matplotlib/pyplot 画矢量图导入word中
- 用户,用户组和权限
- 测试环境搭建之centos系统给php安装php-memcached模块