先准备相关软件,并确保服务器已经安装了gcc,gcc-c++,make三个软件,以便后续编译过程。

  首先安装,

  libxml2  ftp://xmlsoft.org/libxml2/

  下载最新版本(我的是2.9.1,并解压,然后进入解压后的目录,执行 ./configure --prefix=/usr/local/libxml2/
  然后make的时候,一直报错,大概看了下,应该是因为没有装python的编译器,因为我没接触过python,所以只能傻傻地yum install python*,安装了一大堆东西,make终于成功了,求大神告诉我python的编译器是什么。

  好,继续make install。

  接下来安装libmcrypt,我的版本libmcrypt-2.5.8.tar.gz

  libmcrypt  http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz/download

  先解压文件并进入安装目录,

   输入  ./configure --prefix=/usr/local/libmcrypt/

      make && make install

  然后进入libltdl目录,输入
      ./configure --enable-ltdl-install

      make && make install

  OK  然后安装zlib (zlib-1.2.8.tar.gz)

  zlib  http://zlib.net/zlib-1.2.8.tar.gz

    ./configure   (因为zlib库会被很多其他库引用,所以建议不指定安装路径)
    make
    make install

  好了,下面安装libpng( libpng-1.6.9.tar.gz)

  libpng  ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng16/

  ./configure
   make prefix=/usr ZLIBINC=/usr/local/include ZLIBLIB=/usr/local/lib  -f scripts/makefile.linux

  KO,下面安装jpeg库(jpegsrc.v9a.tar.gz)

  jpeg  http://www.ijg.org/files/jpegsrc.v9a.tar.gz

  mkdir /usr/local/jpeg9
  mkdir /usr/local/jpeg9/bin
  mkdir /usr/local/jpeg9/lib
  mkdir /usr/local/jpeg9/include
  mkdir -p /usr/local/jpeg9/man/man1

  ./configure --prefix=/usr/local/jpeg9/ --enable-shared --enable-static
  make
  make install

  好的,接下来安装freetype(freetype-2.5.2)

  freetype  http://download.savannah.gnu.org/releases/freetype/

  ./configure --prefix=/usr/local/freetype/
  make
  make install

  之后便是M4(  m4-1.4.17)

  M4  ftp://ftp.gnu.org/gnu/m4/m4-latest.tar.gz

  ./configure
  make
  make install

  之后便是autoconf(autoconf-2.69 )

  autoconf  ftp://ftp.gnu.org/gnu/autoconf/autoconf-latest.tar.gz

  ./configure
  make
  make install

  OK  接下来安装gd2(libgd-2.1.0.tar.gz)

  gd2  https://bitbucket.org/libgd/gd-libgd/downloads/libgd-2.1.0.tar.gz  ( 此网站被墙,需要代理,或者自己百度找其他人共享的)

   ./configure --prefix=/usr/local/gd2/ --with-jpeg=/usr/local/jpeg9/ --with-freetype=/usr/local/freetype/ --with-png=/usr/
  make

  make install  

  好了,各种准备工作终于做得差不多了,下面安装我们的主角Apache:

  Apache  http://apache.dataguru.cn//httpd/httpd-2.4.7.tar.gz

  ./configure --prefix=/usr/local/apache2/ --sysconfdir=/etc/httpd/ --with-included-apr --disable-userdir --enable-so --enable-deflate=shared --enable-expires=shared --enable-rewrite=shared --enable-static-support

  报错:configure: error: Bundled APR requested but not found at ./srclib/. Download and unpack the corresponding apr and apr-util packages to ./srclib/.
  于是下载:APR http://mirrors.cnnic.cn/apache//apr/apr-1.5.0.tar.gz 和apr-util  http://mirrors.cnnic.cn/apache//apr/apr-util-1.5.3.tar.gz并解压到 ./srclib/目录。

  在apr目录里执行:

  ./configure
  make
  make install

  在apr-util目录里执行

  ./configure  --with-apr=/usr/local/apr/
  make
  make install

  然后返回Apache目录执行

  ./configure --prefix=/usr/local/apache2/ --sysconfdir=/etc/httpd/ --with-included-apr=/usr/local/apr/ --disable-userdir --enable-so --enable-deflate=shared --enable-expires=shared --enable-rewrite=shared --enable-static-support
  有蛋疼地报错,configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/
  只能按照神的指示,到http://pcre.org/下载ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.34.tar.gz,然后解压

  ./configure
  make
  make install

  然后再进入apache目录,执行./configure --prefix=/usr/local/apache2/ --sysconfdir=/etc/httpd/ --with-included-apr=/usr/local/apr/ --disable-userdir --enable-so --enable-deflate=shared --enable-expires=shared --enable-rewrite=shared --enable-static-support,终于KO了。

  接着:

  make
  make install

  然后执行

   /usr/local/apache2/bin/apachectl start
  echo "/usr/local/apache2/bin/apachectl start" >> /etc/rc.d/rc.sysinit

  接下来下载

  ncurses  ftp://invisible-island.net/ncurses/ncurses.tar.gz

  ./configure --with-shared --without-debug --without-ada --enable-overwrite
  make
  make install

  之后便是MySQL

  MySQL  http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.16.tar.gz

  发现没有cmake,于是  yum install cmake

  cmake .

  make
  make install

  cd /usr/local/mysql
  chown  -R mysql .

  chgrp -R mysql .
  scripts/mysql_install_db  --user=mysql
   chown -R root .
  chown -R mysql data
   bin/mysqld_safe --user=mysql &
  cp support-files/mysql.server /etc/init.d/mysql.server

  然后发现mysql启动不了,查看日志发现[ERROR] Can't open the mysql.plugin table. Please run  mysql_upgrade to create it.
  上网查找,发现是自己没配置好数据文件,于是
   vim /etc/my.cnf
  将[mysqld]下的datadir改成   datadir=/usr/local/mysql/data/

  OK  mysqld可以启动了,下面用mysql客户端连接,又想死地提示: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
经过排查,发现应该在 /etc/my.cnf 下添加如下内容

  [mysql]
  socket=/var/lib/mysql/mysql.sock
  成功解决。

  最后就剩PHP了:

  PHP  http://cn2.php.net/get/php-5.5.9.tar.bz2/from/this/mirror

   ./configure --prefix=/usr/local/php/ --with-config-file-path=/usr/local/php/etc/ --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql/ --with-libxml-dir=/usr/local/libxml2/ --with-jpeg-dir=/usr/local/jpeg9/ --with-freetype-dir=/usr/local/freetype/ --with-gd=/usr/local/gd2/ --with-mcrypt=/usr/local/libmcrypt/ --with-mysqli=/usr/local/mysql/bin/mysql_config --with-png-dir=/usr --with-zlib-dir=/usr/local/ --enable-soap --enable-mbstring=all --enable-sockets
  make
  make install

  又报错,error: X11/xpm.h: No such file or directory
  网上查找错误,尝试yum install libXpm* 重新配置
  ./configure --prefix=/usr/local/php/ --with-config-file-path=/usr/local/php/etc/ --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql/ --with-libxml-dir=/usr/local/libxml2/ --with-jpeg-dir=/usr/local/jpeg9/ --with-freetype-dir=/usr/local/freetype/ --with-gd=/usr/local/gd2/ --with-mcrypt=/usr/local/libmcrypt/ --with-mysqli=/usr/local/mysql/bin/mysql_config --with-png-dir=/usr --with-zlib-dir=/usr/local/ --with-xpm-dir=/usr/ --enable-soap --enable-mbstring=all --enable-sockets
  make && make install

  cp php.ini-production /usr/local/php/etc/php.ini
  echo "Addtype application/x-httpd-php .php .phtml" >> /etc/httpd/httpd.conf
  /usr/local/apache2/bin/apachectl restart

  终于完工了。

Linux下配置LAMP环境的更多相关文章

  1. Linux下配置Lamp

    linux下配置lamp步骤: 一.快速安装Apache+PHP5+MySql 先更新: # yum update 然后安装LAMP环境:(163的yum源上只有php5.1.6 mysql 5.0. ...

  2. linux下搭建lamp环境以及安装swoole扩展

    linux下搭建lamp环境以及安装swoole扩展   一.CentOS 6.5使用yum快速搭建LAMP环境 准备工作:先更新一下yum源  我安装的环境是:apache2.2.15+mysql5 ...

  3. Linux下配置Node环境变量及问题详解

    这是之前在Linux下配置Node环境变量时踩过的坑,今天又有小伙伴询问这个问题,因此记录下来,不仅是给新童鞋们一些参考,也方便日后查阅 在这之前,相信都已经安装好了,没安装的可以查看博主另一篇文章 ...

  4. windows下配置lamp环境(5)---配置MySQL5.6

    开始配置mysql 1.创建配置文件my.ini   1.进入C:\wamp\MySQL   2.把my-default.ini 另存一份:my.ini   3.开始编辑mysql的配置文件,打开my ...

  5. windows下配置lamp环境(3)---配置PHP5.4

    下面配置php Php文件夹里有两个php.ini-*文件,随便修改一个,去掉后缀,变成php.ini (如图) 打开php.ini ,添加php扩展目录723行左右(其实放哪都无所谓,只不过php. ...

  6. windows下配置lamp环境(0)---软件获取

    工作快一年了,还没有怎么配置过服务器环境,经常使用集成套件wampserver,为了复习配置wamp服务器 特意在虚拟机中测试安装步骤如下. 安装前步骤:下载软件.软件下载地址如下: 1.apache ...

  7. windows下配置lamp环境(2)---配置Apache服务器2.2.25

    配置Apache 配置Apache时,先要找到安装目录中的主配置文httpd.conf,使用文本编辑器打开,最好不要使用windows自带的编辑器,可以使用NotePad++, vim,或者subli ...

  8. windows下配置lamp环境(1)---安装Apache服务器2.2.25

    window下lamp成为wamp; 安装wamp环境的第一步是安装Apache服务器.下面开始安装步骤图文并茂. 一.双击安装包点“next”进行下一步,然后同意协议(这张图没有截):

  9. linux下配置python环境 django创建helloworld项目

    linux下配置python环境 1.linux下安装python3 a. 准备编译环境(环境如果不对的话,可能遇到各种问题,比如wget无法下载https链接的文件) yum groupinstal ...

随机推荐

  1. event——事件对象详解

    PS:转自https://www.cnblogs.com/songyaqi/p/5204143.html 1. 事件对象 Event 对象代表事件的状态,比如事件在其中发生的元素.键盘按键的状态.鼠标 ...

  2. Appium基础五:appium相关API

    1.获取信息类: 1.1 获取当前界面的组件: driver.currentActivity(); //获取当前界面的activity,可用于断言是否跳转到预期的activity 1.2 获取当前页面 ...

  3. JFinal视频教程-JFnal学院分享课

    最近JFinal学院出了JFinal视频教程分享课,请笑纳~ 课程列表: 1.[JFinal版]微信小程序富文本渲染解决方案-html2wxml4J分享课 这个课程主要讲的是使用基于JFinal开发的 ...

  4. Android笔记--LayoutInflator源码和使用分析

    LayoutInflator源码分析 获取LayoutInflator对象 获取LayoutInflator的方式有两种: 使用LayoutInflator.from(Context context) ...

  5. String 对象详解

    原文地址:http://zangweiren.javaeye.com/blog/209895 作者:臧圩人(zangweiren) 网址:http://zangweiren.javaeye.com & ...

  6. 洛谷 P1074 靶形数独

    题目描述 小城和小华都是热爱数学的好学生,最近,他们不约而同地迷上了数独游戏,好胜的他 们想用数独来一比高低.但普通的数独对他们来说都过于简单了,于是他们向 Z 博士请教, Z 博士拿出了他最近发明的 ...

  7. cluvfy stage命令用法

    1.获取集群验证工具cluvfy的帮助信息 grid@rac1:/home/grid>cluvfy -help USAGE: cluvfy [ -help ] cluvfy stage { -l ...

  8. CF Gym 100637A Nano alarm-clocks

    题意:给你一些钟的时间,只可以往后调, 问最少调的时间总和是多少 题解:因为肯定是调到某个出现过时间的,只要枚举时间,在维护一个前缀和快速计算出时间总和就行了. #include<cstdio& ...

  9. 【转】在MAC下使用ISO制作Linux的安装USB盘

    http://www.linuxidc.com/Linux/2013-04/82973.htm 在Mac环境下,将Linux的ISO镜像生成一个Linux的安装盘,和Linux下差不多,只是Mac下有 ...

  10. BCB:Windows消息处理

    Windows消息处理 BCB 本文研究了BCB中的消息处理机制,在此基础上提出了处理Windows消息和自定义消息响应的方法和建立动态和静态消息映射的技巧. C++ Builder作为一种RAD方式 ...