zoukankan      html  css  js  c++  java
  • Centos 5.5 Lamp源码包安装编译 新风宇宙

     yum install zlib-devel openssl-devel 

    一.下载Apache http://labs.renren.com/apache-mirror//httpd/httpd-2.2.17.tar.gz

    下载mysql http://download.freelamp.com/LAMP/mysql-5.0.41.tar.gz 

    下载 phphttp://cn.php.net/distributions/php-5.2.14.tar.gz 

    下载ncurseshttp://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.6.tar.gz 

    下载jpeg6http://down1.chinaunix.net/distfiles/jpegsrc.v6b.tar.gz 

    下载 libpng http://down1.chinaunix.net/distfiles/libpng-1.2.10.tar.bz2 

    下载  freetype  http://down1.chinaunix.net/distfiles/freetype-2.3.9.tar.bz2

    下载 zlib -1.2.3.tar.gz: http://download.chinaprj.cn/detail/iDssDTsO

    下载gd-2.0.33.tar.gzhttp://down1.chinaunix.net/distfiles/gd-2.0.33.tar.gz

    下载 curl-7.18.2.tar.bz2   http://down1.chinaunix.net/distfiles/curl-7.18.2.tar.bz2

    下载  libxml2-2.7.2.tar.gz  http://down1.chinaunix.net/distfiles/libxml2-2.7.2.tar.gz

    下载  libxslt-1.1.23.tar.gz  http://down1.chinaunix.net/distfiles/libxslt-1.1.23.tar.gz

    二. 安装Apache

    1.解压:[root@localhost src]# tar zxvf httpd-2.2.16.tar.gz 

       2.[root@localhosthttpd-2.2.16]#./configure --prefix=/usr/local/apache2 --with-included-apr --with-mpm=worker --enable-deflate --enable-cache --enable-disk-cache --enable-file-cache --enable-mem-cache --enable-rewrite --enable-so --enable-speling --enable-ssl --with-apr --with-apr-util --with-ssl --with-z --enable-modules=all --enable-mods-shared=all

    编译指令的说明如下

    --prefix=/usr/local/apache2 

      //Apache的安装目录。

    --enable-module=so 

      //打开 so 模块,so 模块是用来提 DSO 支持的 apache 核心模块

    --enable-deflate=shared //支持网页压缩

    --enable-expires=shared //支持 HTTP 控制

    --enable-rewrite=shared //支持 URL 重写

    --enable-cache //支持缓存

    --enable-file-cache //支持文件缓存

    --enable-mem-cache //支持记忆缓存

    --enable-disk-cache //支持磁盘缓存

    --enable-static-support //支持静态连接(默认为动态连接)

    --enable-static-htpasswd 

      //使用静态连接编译 htpasswd - 管理用于基本认证的用户文件

    --enable-static-htdigest 

      //使用静态连接编译 htdigest - 管理用于摘要认证的用户文件

    --enable-static-rotatelogs 

      //使用静态连接编译 rotatelogs - 滚动 Apache 日志的管道日志程序

    --enable-static-logresolve 

      //使用静态连接编译 logresolve - 解析 Apache 日志中的IP地址为主机名

    --enable-static-htdbm 

      //使用静态连接编译 htdbm - 操作 DBM 密码数据库

    --enable-static-ab 

      //使用静态连接编译 ab - Apache HTTP 服务器性能测试工具

    --enable-static-checkgid 

      //使用静态连接编译 checkgid

    --disable-cgid 

      //禁止用一个外部 CGI 守护进程执行CGI脚本

    --disable-cgi //禁止编译 CGI 版本的 PHP

    --disable-userdir //禁止用户从自己的主目录中提供页面

    --with-mpm=worker // apacheworker方式运行

    --enable-authn-dbm=shared // 对动态数据库进行操作。Rewrite时需要。

    按照apache官方文档的说法,--enable-mods-shared=all并不会启用

    所有的额外模块,要想把所有的模块都安装,应该使用 

    --enable-mods-shared="all ssl ldap cache proxy authn_alias mem_cache 

             file_cache authnz_ldap charset_lite dav_lock disk_cache" 

    对 --enable-modules也是一样的。呵呵,好强大。

    3.启动Apache

    [root@localhost ]# cd  /usr/local/apache2/bin

    [root@localhost bin]# ./apachectl start

    [root@localhost bin]# netstat -an | grep 80

    tcp        0      0 :::80                 :::*                     LISTEN      

    4.访问:http://ip 显示 It works

    5.编辑httpd.conf 支持php

    找到index.html 在后面添加index.php

    找到“AddType application/x-gzip .tgz”这一行,在下面添加

     AddType application/x-httpd-php .php 

     AddType application/x-httpd-php-source .phps

    找到“DirectoryIndex index.html”,改为:  DirectoryIndex index.php index.html找到“#ServerName”,去掉注释的#号。

    将所有“AllowOverride None”,改为:  AllowOverride All

    6.设置开机启动:

    [root@localhost apache2]# cp /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/httpd

    [root@localhost apache2]# chmod 755 /etc/rc.d/init.d/httpd

    三.安装Mysql

    1.[root@localhost src]# tar zxvf ncurses-5.6.tar.gz 

    2[root@localhost ncurses-5.6]#./configure 

    3.[root@localhost ncurses-5.6]#make && make install

    4.解压:tar zxvf mysql-5.0.41.tar.gz 

    5.[root@localhostmysql-5.0.41]# ./configure --prefix=/usr/local/mysql --enable-assembler  --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --with-charset=utf8  --with-collation=utf8_general_ci --with-extra-charsets=complex --enable-local-infile  --disable-shared --with-plugins=all --with-mysqld-user=mysql --with-pthread   --enable-thread-safe-client

    6.[root@localhostmysql-5.0.41]#make && make install

    编译配置指令的意思是,

    --enable-assembler  

      # 启用寄存器模式

    --with-client-ldflags=-all-static 

      #为客户端编译静态程序

    --with-mysqld-ldflags=-all-static 

      #为服务器端编译静态程序

    --with-charset=utf8 

      #数据库编码使用utf8,默认的是latin1,可以设置的是

      #binary armscii8 ascii big5 cp1250 cp1251 cp1256 cp1257

      #cp850 cp852 cp866 cp932 dec8 eucjpms euckr gb2312 gbk geostd8

      #greek hebrew hp8 keybcs2 koi8r koi8u

      #latin1 latin2 latin5 latin7 macce macroman

      #sjis swe7 tis620 ucs2 ujis utf8

    --with-collation = 

      #数据库校验规则,--with-carset要和withc-collation一起使用才有效。

      #要想更改字符集和校对规则,要同时使用--with-charset--with-collation选项。

      #校对规则必须是字符集的合法校对规则。参见下面的链接

    --with-extra-charsets=complex  

      #增加对复杂编码的支持(可选,none, complex, all)

    --with-plugins=all 

      #安装所有插件,默认不安装,可以使用一系列逗号分隔符来描述要安装的内容。

      #可用的配置为 none max max-no-ndb all

      #可用的插件为 partition daemon_example

      #ftexample archive blackhole csv example federated

      #heap ibmdb2i innobase innodb_plugin myisam myisammrg

      #ndbcluster.

    --with-mysqld-user=mysql  

      #指定mysql守护进程的启动用户

    --disable-shared 

      # 禁用共享库

    --with-pthread  

      #强制使用pthread

    --enable-thread-safe-client  

      #如果客户端使用多线程,那么应该使用此选项以编译线程安全的客户端

    还有一些编译指令是,

    --prefix=/usr/local/mysql  # 不说了

    --with-tcp-port=3306 

      #mysqld守护进程使用的端口,默认就是3306

    --with-unix-socket-path=/tmp/mysql.sock 

      #unix套接字库路径,默认是/tmp/mysql.sock

    --with-debug 和 --with-debug=full  

      #生成调试代码和库 witout-debug关闭调试

     7.初始化授权表 

    cd /usr/local/mysql/bin/

       ./mysql_install_db --user=mysql

    8.启动 mysql

    [root@localhost bin]# ./mysqld_safe --user=mysql &

    cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysqld (添加守护进程)

    chmod +x /etc/init.d/mysql (添加执行权限)

    chkconfig --level 345 mysql on (chkconfig设置守护进程自动启动)

    9.mysql配置文件

    [root@localhost mysql]# cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf

    10.修改密码

    修改root用户密码

    [root@tigertall local]# mysql -u root

    mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpwd');

    mysql> SET PASSWORD FOR 'root'@'host_name' = PASSWORD('newpwd');

    用服务器主机名替换第二个SET PASSWORD语句中的host_name。这是你指定匿名账户密码的主机名。

    要想使用mysqladminroot账户指定密码,执行下面的命令:

    [root@tigertall local]# mysqladmin -u root password "newpwd"

    [root@tigertall local]# mysqladmin -u root -h host_name password "newpwd"

    四:安装GD(PHP支持GIF,PNG,JPEG) 

    a.安装 jpeg6建立目录:

    # mkdir -p /usr/local/jpeg6

    # mkdir -p /usr/local/jpeg6/bin

    # mkdir -p /usr/local/jpeg6/lib

    # mkdir -p /usr/local/jpeg6/include

    # mkdir -p /usr/local/jpeg6/man

    # mkdir -p /usr/local/jpeg6/man1

    # mkdir -p /usr/local/jpeg6/man/man1

    # tar -zvxf jpegsrc.v6b.tar.gz

    # cd jpeg-6b

    # ./configure --prefix=/usr/local/jpeg6/ --enable-shared --enable-static

    # make && make install

    b.安装libpng

    # tar -zvxf libpng-1.2.10.tar.gz

    # cd libpng-1.2.10

    # cp scripts/makefile.std makefile

    # make && make install

    c.安装 freetype

    # tar -jvxf freetype-2.3.9.tar.bz2

    # cd freetype-2.3.9# mkdir -p /usr/local/freetype

    # ./configure --prefix=/usr/local/freetype

    # make && make install

    d.:安装zlib

    #tar -zxvf zlib-1.2.3.tar.gz

    #cd zlib.1.2.3

    # ./configure

    # make && make install

    e.安装GD

    # tar -zvxf gd-2.0.33.tar.gz

    # mkdir -p /usr/local/gd2

    # cd gd-2.0.33

    #./configure --prefix=/usr/local/gd2 --with-jpeg=/usr/local/jpeg6/ --with-png=/usr/local/lib/  --with-zlib=/usr/local/lib/ --with-freetype=/usr/local/freetype/

    # make && make install

    e.安装Curl# tar -jxf curl-7.18.2.tar.bz2

    # mkdir -p /usr/local/curl

    # ./configure --prefix=/usr/local/curl

    # make &&  make install

    五:安装php5php5必须有libxml2支持!

    a.安装libxml2

    b.# tar -zxf libxml2-2.6.19.tar.gz

    c.# cd libxml2-2.6.19

    d.# mkdir -p /usr/local/libxml2

    e.# ./configure --prefix=/usr/local/libxml2

    f.# make && make install

    b.安装 libxslt(可选安装,你可以不安装)

    # tar -zxf libxslt-1.1.15.tar.gz

    # mkdir -p /usr/local/libxslt# cd libxslt-1.1.15

    # ./configure --prefix=/usr/local/libxslt --with-libxml-prefix=/usr/local/libxml2

    # make &&  make install

    五.安装PHP

    1.编译./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs  --with-mysql=/usr/local/mysql --with-curl=/usr/local/curl --enable-ftp  --with-libxml-dir=/usr/local/libxml2 --with-expat-dir=/usr/lib --enable-soap  --with-xsl=/usr/local/libxslt --enable-xslt --with-gd=/usr/local/gd2/  - -with-jpeg-dir=/usr/local/jpeg6/ --with-zlib-dir=/usr/local/lib/ --with-png=/usr/local/lib/  - -with-freetype-dir=/usr/local/freetype/ 

    2. make && make install

    3.php.ini

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

    3.编译说明:

    其中./configure 后的 

    --prefix=/usr/local/php 

    --with-apxs2=/usr/local/apache/bin/apxs 

    --with-mysql=/usr/local/mysql/ 

    --with-libxml-dir=/usr/local/libxml2 

    是必要的选项 

    --with-gd=/usr/local/gd2/ 

    --with-jpeg-dir=/usr/local/jpeg6/ 

    --with-png=/usr/local/lib 

    --with-zlib-dir=/usr/lib 

    --with-freetype-dir=/usr/local/freetype 

    这是让PHP支持GD库的配置选项 

    --with-curl=/usr/local/curl 支持CURL库 

    --enable-ftp 打开FTP库函数支持 

    --enable-soap --with-xsl=/usr/local/libxslt --enable-xslt 

    PHP支持SOAP, 上面这些一般用得少可以去掉 

    4.进行php.ini文件的配置工作 

    查找safe_mode=Off,更改为safe_mode=On 

    1)查找max_execution_time = 30,更改为max_execution_time = 600 

    2)查找max_input_time = 60,更改为max_input_time = 600 

    3)查找memory_limit = 128M ,更改为memory_limit = 512M 

    4)查找display_errors = On,更改为display_errors = Off 

    5)查找register_globals = Off,更改为register_globals = On 

    六.最后阶段

    Apache目录下添加index.php 测试

    [root@localhost apache2]# cat htdocs/index.php

    <?

    phpinfo();

    ?>

  • 相关阅读:
    10 个雷人的注释,就怕你不敢用!
    Java 14 之模式匹配,非常赞的一个新特性!
    poj 3661 Running(区间dp)
    LightOJ
    hdu 5540 Secrete Master Plan(水)
    hdu 5584 LCM Walk(数学推导公式,规律)
    hdu 5583 Kingdom of Black and White(模拟,技巧)
    hdu 5578 Friendship of Frog(multiset的应用)
    hdu 5586 Sum(dp+技巧)
    hdu 5585 Numbers
  • 原文地址:https://www.cnblogs.com/php5/p/2097377.html
Copyright © 2011-2022 走看看