先准备相关软件,并确保服务器已经安装了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. Ubuntu 设置静态ip地址

    1. 找到文件并作如下修改: sudo vim /etc/network/interfaces 修改如下部分: auto eth0iface eth0 inet staticaddress 192.1 ...

  2. Exchange 用户邮箱导入/导出

    在第2部分中,我将向您介绍如何使用Exchange Server中提供的新cmdlet导入/导出数据,以及如何查看导入和导出的信息统计信息这样做. 走起! 将数据从PST文件导入到邮箱 现在是时候尝试 ...

  3. Windows平台下如何在C#中调用Python

    最近迷上了Python,发现它能够做很多C#无法完成的事情,比如,调用CMD或者在CMD中执行一个exe文件命令行并获得输出的结果.过程简单,处理起来也非常方便,但如果要用C#调用Python文件呢, ...

  4. 谷歌浏览器Chrome developer tool详细介绍

    http://www.cr173.com/html/19114_4.html 第 4 页 js调试源码控制面板 5 源码控制面板(js调试) Javascript的调试,基本上是通过源码控制面板和命令 ...

  5. POJ 2923 Relocation(01背包+状态压缩)

    题意:有人要搬家,有两辆车可以运送,有若干家具,车有容量限制,而家具也有体积,那么如何运送会使得运送车次最少?规定两车必须一起走,两车一次来回只算1躺. 思路:家具怎么挑的问题,每趟车有两种可能:1带 ...

  6. extranuclear gene|non-Mendelian inheritance|uniparental inheritance|maternal inheritance

    5.8某些细胞器含有DNA 因为除细胞核内的染色体外,细胞质中的细胞器上也有遗传物质(这类遗传物质被称为核外基因(extranuclear gene),比如线粒体上的rRNA,这是因为细胞器基因组是独 ...

  7. cocos2dx for iOS fmod的音效引擎接入

    上一个博客我写了一篇fmod的android接入过程,这一次介绍一下ios接入fmod的方法. 首先下载fmod的api包,解压后,在FMOD Programmers API/api文件夹下有lowl ...

  8. C/C++字符串笔试知识点及实例

    一.C字符串与C++字符串的深入理解 对于C语言,需要区分C字符串和C字符数组.  C字符串:以字符NULL('\0')结尾的字符数组:  C字符数组:数组元素类型为字符类型. C字符串的的初始化:c ...

  9. C语言实现两数相加2018-09-23

    /*给定两个非空链表来表示两个非负整数.位数按照逆序方式存储,它们的每个节点只存储单个数字.将两数相加返回一个新的链表. 你可以假设除了数字 0 之外,这两个数字都不会以零开头. 示例: 输入:(2 ...

  10. 转 Anaconda启动卡死的解决方案

    https://blog.csdn.net/meng_zhi_xiang/article/details/83651676