设为首页 收藏本站
查看: 1959|回复: 0

Linux下配置LAMP环境

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2015-8-19 10:00:16 | 显示全部楼层 |阅读模式
  先准备相关软件,并确保服务器已经安装了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

  
    终于完工了。

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-100996-1-1.html 上篇帖子: Building a LAMP Server 下篇帖子: LAMP安装步骤整理
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表