软件版本:

pcre-8.36.tar.gz
apr-1.5.1.tar.gz
apr-util-1.5.4.tar.gz
httpd-2.4.12.tar.bz2

mysql-5.6.24.tar.gz

libxml2-2.7.8.tar.gz
libpng-1.5.12.tar.gz
freetype-2.4.10.tar.gz
jpegsrc.v7.tar.gz
gd-2.0.35.tar.gz
php-5.4.39.tar.gz

百度云下载地址:http://pan.baidu.com/s/1dDGT9KH

步骤概要:

1、apache

2、mysql

3、php

4、验证

备注

所有操作(未特殊说明)都是以:/usr/local/src 为操作目录, 且所有软件包均在此目录下。

具体步骤:

安装apache

软件包依赖:pcre, apr, apr-util

1、prce 安装(安装目录,以将来安装httpd 的目录(/usr/local/services/httpd-2.4.12/)为基准,并且安装到plugins目录下,方便将来同型号机器移植

tar zxf pcre-8.36.tar.gz
cd pcre-8.36
./configure --prefix=/usr/local/services/httpd-2.4.12/plugins/pcre-8.36
make make install

2、apr, apr-util 在apache的安装文档中有具体操作说明,如下

tar zxf apr-1.5.1.tar.gz -C ./httpd-2.4.12/srclib/
tar zxf apr-util-1.5.4.tar.gz -C ./httpd-2.4.12/srclib/
cd httpd-2.4.12/srclib/
ln -s apr-util-1.5.4/ apr-util
ln -s apr-1.5.1 apr

3、安装apache

tar zxf httpd-2.4.12.tar.gz
cd httpd-2.4.12
./configure \
--prefix=/usr/local/services/httpd-2.4.12 \
--with-pcre=/usr/local/services/httpd-2.4.12/plugins/pcre-8.36 \
--with-included-apr \
--enable-rewrite=shared \
--enable-so make make install

安装mysql

准备条件:cmake, ncurses-devel, bison, 如果未安装直接yum install xxx

tar zxf mysql-5.6.24.tar.gz

cd mysql-5.6.24

cmake \
-DCMAKE_INSTALL_PREFIX:PATH=/usr/local/services/mysql-5.6.24 \
-DMYSQL_DATADIR:PATH=/data/mysql \
-DEXTRA_CHARSETS=all \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_READLINE=1 \
-DMYSQL_USER=mysql \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_SSL=yes make make install #添加软连接
ln -s /usr/local/services/mysql-5.6.24/ mysql
#添加PATH
echo "PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile
source /etc/profile
#修改目录权限
mkdir -p /data/mysql
chown -R mysql:mysql /usr/local/mysql
chown -R mysql:mysql /data/mysql
#拷贝配置文件
cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf # 添加用户
groupadd mysql
useradd -g mysql mysql #设置my.conf 在[mysqld]中设置
datadir=/data/mysql #初始化
/usr/local/mysql/scripts/mysql_install_db --user=mysql --datadir=/data/mysql --basedir=/usr/local/mysql #设置mysql服务
cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld
chkconfig --add mysqld
service mysql start #空密码登陆mysql
mysql #mysql 设置权限,同一个用户在不同机器上的密码可能不同。
grant all privileges on *.* to root@'localhost' identified by '123456';
grant all privileges on *.* to root@'%' identified by '123456'; # root密码登陆
mysql -uroot -p123456

注意:

安装完成后首次登陆,报错 Segmentation fault
这是一个bug: https://bugs.launchpad.net/percona-server/+bug/1201123
解决:
1、源码包里,编辑文件 cmd-line-utils/libedit/terminal.c, 找到代码段(869行) char buf[TC_BUFSIZE]; 将其注释,找到下面的变量(879行) area = buf; ,更改为 area = NULL; 
2、重新编译即可

安装php

分为3步

1、libxml2

2、gd2

3、php

安装libxml2

tar zxf libxml2-2.7.8.tar.gz
cd libxml2-2.7.8
./configure \
--prefix=/usr/local/services/php-5.4.39/plugins/libxml2-2.7.8

安装gd

包括:libpng , freetype,  jpeg, gd

安装libpng

tar zxf libpng-1.5.12.tar.gz
cd libpng-1.5.12
./configure \
--prefix=/usr/local/services/php-5.4.39/plugins/libpng-1.5.12

安装freetype

tar zxf freetype-2.4.10.tar.gz
cd freetype-2.4.10
./configure \
--prefix=/usr/local/services/php-5.4.39/plugins/freetype-2.4.10

安装jpeg

tar zxf jpegsrc.v7.tar.gz
cd jpeg-7
./configure \
--prefix=/usr/local/services/php-5.4.39/plugins/jpeg-7

安装gd

tar zxf gd-2.0.35.tar.gz
cd gd-2.0.35
./configure \
--prefix=/usr/local/services/php-5.4.39/plugins/gd-2.0.35 \
--with-freetype=/usr/local/services/php-5.4.39/plugins/freetype-2.4.10 \
--with-png=/usr/local/services/php-5.4.39/plugins/libpng-1.5.12 \
--with-jpeg=/usr/local/services/php-5.4.39/plugins/jpeg-7

安装php

./configure \
--prefix=/usr/local/services/php-5.4.39 \
--with-mysql=/usr/local/services/mysql-5.6.24 \
--with-mysqli=/usr/local/services/mysql-5.6.24/bin/mysql_config \
--with-pdo-mysql=/usr/local/services/mysql-5.6.24 \
--with-apxs2=/usr/local/services/httpd-2.4.12/bin/apxs \
--with-libxml-dir=/usr/local/services/php-5.4.39/plugins/libxml2-2.7.8 \
--with-gd=/usr/local/services/php-5.4.39/plugins/gd-2.0.35 \
--with-freetype-dir=/usr/local/services/php-5.4.39/plugins/freetype-2.4.10 \
--with-png-dir=/usr/local/services/php-5.4.39/plugins/libpng-1.5.12 \
--with-jpeg-dir=/usr/local/services/php-5.4.39/plugins/jpeg-7 \
--enable-mbstring \
--enable-maintainer-zts \
--enable-sockets \
--enable-pcntl \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-soap \
--enable-shmop \
--enable-bcmath \
--enable-zip \
--enable-calendar \
--enable-ctype \
--enable-dom \
--enable-filter \
--enable-gd-native-ttf \
--enable-hash \
--enable-json \
--enable-posix \
--enable-shared \
--enable-simplexml \
--enable-static \
--enable-tokenizer \
--enable-xml \
--enable-xmlwriter \
--enable-pdo \
--enable-inline-optimization \
--enable-mysqlnd \
--enable-exif


make

make install

编译遇到错误:

In file included from /kk/php-5.4.0/ext/gd/gd.c:103:
/kk/php-5.4.0/ext/gd/gd_ctx.c: In function ‘_php_image_stream_putc’:

解决(google后, bug: https://bugs.php.net/bug.php?id=55224):

vim /usr/local/services/php-5.4.39/plugins/gd-2.0.35/include/gd_io.h
中(14行) typedef struct gdIOCtx 结构体中添加:void (*data);
修改后如下:
typedef struct gdIOCtx
{
int (*getC) (struct gdIOCtx *);
int (*getBuf) (struct gdIOCtx *, void *, int); void (*putC) (struct gdIOCtx *, int);
int (*putBuf) (struct gdIOCtx *, const void *, int); /* seek must return 1 on SUCCESS, 0 on FAILURE. Unlike fseek! */
int (*seek) (struct gdIOCtx *, const int); long (*tell) (struct gdIOCtx *); void (*gd_free) (struct gdIOCtx *); void (*data); }

重新编译,编译成功

配置与测试

1、创建软连接与添加PATH

ln -s /usr/local/services/php-5.4.39 php
ln -s /usr/local/services/httpd-2.4.12 apache
ln -s /usr/local/services/mysql-5.6.24 mysql echo "PATH=$PATH:/usr/local/php/bin:/usr/local/mysql/bin" >> /etc/profile
source profile

2、设置php.ini

cp php.ini-development /usr/local/php/lib/php.ini

3、配置apache httpd.conf 支持php文件解析

echo "AddType application/x-httpd-php .php" >> /usr/local/apache/conf/httpd.conf

4、构建文件测试

vim /usr/local/apache/htdocs/phpinfo.php
<?php
phpinfo();

5、重启apache

/usr/local/apache/bin/apachectl restart

6、访问验证

浏览器访问: http://127.0.0.1/phpinfo.php

显示如下:

2015年4月16日 更新支持mysql-pdo

Lamp 安装(CentOS6.6, php-5.4.39, httpd-2.4.12, mysql-5.6.24)的更多相关文章

  1. linux基础——文件挂载,lamp安装

    一. 文件挂载 lsblk -f 显示文件系统信息 mount -t vfat UUID="ffffffffff" /mnt   挂载到/mnt目录 Linux针对于各式U盘挂载方 ...

  2. VMware7安装CentOS6.5教程

    VMware7安装CentOS6.5教程 http://www.91linux.com/html/2014/CentOS_0415/9727.html工欲善其事,必先利其器.学习linux系统,必须先 ...

  3. Linux PXE自动化安装centos6,centos7系统

    1.PXE是什么? pxe是Preboot Excution Environment的缩写,是intel公司研发,基于client/server的网络模式,支持远程主机通过网络从远端服务器下载镜,并由 ...

  4. Kvm--02 安装centos6系统 ,kvm磁盘管理

    目录 1.安装一个CentOS6的系统的虚拟主机 2.虚拟机的备份 3.企业案例: 4.Kvm磁盘管理 1.安装一个CentOS6的系统的虚拟主机 #上传一个CenOS6系统的镜像到/opt目录下 [ ...

  5. 虚拟机安装CentOS6.4

    1  概述 虚拟机(Virtual Machine)指通过软件模拟的具有完整硬件系统功能的.运行在一个完全隔离环境中的完整计算机系统,运行在主机上,完全独立,虚拟机里面的所有操作不会影响主机,即使虚拟 ...

  6. 。U盘安装CentOS6.5

    最近着手自学Linux,网上有很多CentOS的各种版本,但查阅到的教程基本都是关于CentOS6的,本着最新的版本并不一定是最适合的版本的原则,我选择安装CentOS6.5.安装系统稍微不注意就会出 ...

  7. VMware10 安装centos6.7 设置NAT模式

    最近刚开始学Linux运维.我看的书是<跟阿铭学Linux>,视频教程里面使用NAT模式手动分配IP可以成功ping通网关,但是我照着视频一步一步操作却一直不成功,不知道是什么原因,昨天弄 ...

  8. 虚拟机安装 Centos6

    1 虚拟机安装 Centos6 1.1 前期配置 New Virtual Machine———Typical(典型安装) 选择镜像文件. 设置文件名,用户名和密码. 设置系统在虚拟机软件的名称, 设置 ...

  9. 在VMware上安装CentOS-6.5 minimal - 安装VMware Tools

    由于CentOS-6.5 minimal很多工具都默认没有安装,安装VMwareTools需要用到Perl,所以老伯建议先配置好网络再接着安装. 网络配置方法可以参考在VMware上安装CentOS- ...

随机推荐

  1. NSMutableAttributedString 富文本删除线的用法

    #import <UIKit/UIKit.h> //价格 NSString *priceStr = @"99元 剁手价66元"; NSMutableAttributed ...

  2. ajax 开始的loading加载

    注意是异步加载方式 $.ajax({ beforeSend:function(){ $("#showMes").html('loading...'); },  success: f ...

  3. change-resource-tags.sh

    #!/bin/bash ids=$(aws ec2 describe-instances --filter "Name=tag:Project,Values=ERPSystem" ...

  4. 创建MySQL 用户

    create user 'lixianming'@'localhost' identified by 'lxm123456'; grant all on art.* to 'lixianming'@' ...

  5. 不使用spring的情况下原生java代码两种方式操作mongodb数据库

    由于更改了mongodb3.0数据库的密码,导致这几天storm组对数据进行处理的时候,一直在报mongodb数据库连接不上的异常.   主要原因实际上是和mongodb本身无关的,因为他们改的是配置 ...

  6. BigDecimal 的roundMode 舍位模式

    roundMode是指舍位时候的模式,传参数的时候用BigDecimal.ROUND_XXXX_XXX,   有: 以下例子是setScale(0,BigDecimal.ROUND_XXXX_XXX) ...

  7. Redis部分数据结构方法小结

    package com.practice.util; import java.util.HashMap; import java.util.List; import java.util.Map; im ...

  8. mysql 联合索引(转)

    http://blog.csdn.net/lmh12506/article/details/8879916 mysql 联合索引详解 联合索引又叫复合索引.对于复合索引:Mysql从左到右的使用索引中 ...

  9. 每天一个 Linux 命令(8):cp 命令

    cp命令用来复制文件或者目录,是Linux系统中最常用的命令之一.一般情下,shell会设置一个别名,在命令行下复制文件时,如果目标文件已经存在,就会询问是否覆盖,不管你是否使用-i参数.但是如果是在 ...

  10. 【IIS8】在IIS8添加WCF服务支持

    最近在做Silverlight,Windows Phone应用移植到Windows 8平台,在IIS8中测试一些传统WCF服务应用,发现IIS8不支持WCF服务svc请求,后来发现IIS8缺少对WCF ...