首页 > 代码库 > (apache2.4.7 php5.4.25 mysql 5.5.23) 编译安装

(apache2.4.7 php5.4.25 mysql 5.5.23) 编译安装

环境要求

  gcc、gcc-c++、cmake、bison(可能)支持

  1、yum install gcc gcc-c++ cmake bison  

  2、修改yum配置,达到搜索本地设置

    移走或改名/etc/yum.repos.d/CentOS-Base.repo

    修改 vi /etc/yum.repos.d/CentOS-Media.repo      

      baseurl=file:///mnt/cdrom 

      enabled=1

  3、卸载原有的apache、mysql等    

    rpm -qa |grep mysql 是否安装

    ps -le |grep mysql 进程是否启动

    yum remove httpd 卸载

  4、禁用SeLinux和Netfilter/iptables

    vi /etc/sysconfig/selinux

    Netfilter/iptables 防火墙(默认禁用80)
    iptables -F 禁用

资源库要求

  libxml2、libmcrypt、zlib、libpng、jpeg、freetype、gd、pcre、apr和apr-util 库

  安装步骤

    1、解压 .tar.gz tar -zxf
    2、./configure 配置
    3、make 编译
    4、make install 安装、拷贝

----------------------------------------------------------------------

  安装libxml2

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

----------------------------------------------------------------------

  安装libmcrypt
    ./configure --prefix=/usr/local/libmcrypt/  --enable-ltdl-install

----------------------------------------------------------------------
  安装zlib

    ./configure 不指定安装目录(指定后无法定位)

    卸载不指定安装目录的程序
    make install > /bakcup/zlib_20150905.install.log

----------------------------------------------------------------------

  安装libpng
    ./configure --prefix=/usr/local/libpng/

----------------------------------------------------------------------

  安装jpeg 要先手动创建所需的目录
    mkdir /usr/local/jpeg
    mkdir /usr/local/jpeg/bin
    mkdir /usr/local/jpeg/lib
    mkdir /usr/local/jepg/include
    mkdir -p /usr/local/jepg/man/man1 同时创建多个目录
    ./configure --prefix=/usr/local/jpeg6/ --enable-shared --enable-static

----------------------------------------------------------------------

  安装freetype
    ./configure --prefix=/usr/local/freetype/

----------------------------------------------------------------------

  安装gd 要用到之前安装的库
    ./configure --prefix=/usr/local/gd/ --with-jpeg=/usr/local/jpeg/ --with-freetype=/usr/local/freetype/ 
    --enable-m4_pattern_allow(出错时可能用到该项)   

----------------------------------------------------------------------

  安装pcre
    ./configure --prefix=/usr/local/pcre/   

----------------------------------------------------------------------

  安装apache 用到之前安装的库
    ./configure --prefix=/usr/local/apache/ --sysconfdir=/etc/httpd/ --with-pcre=/usr/local/pcre/ --with-included

-apr --disable-userdir --enable-so --enable-deflate=shared --enable-expires-shared --enable-rewrite=shared --
enable-static-support

    有的版本要求把apr和apr-util库复制到apache安装目录下的srclib下 或单独安装

----------------------------------------------------------------------

  安装mysql 没有configure文件        

    添加mysql账户

    /usr/sbin/groupadd mysql

    /usr/sbin/useradd -g mysql mysql

    cmake -dcmake_install_prefix=/usr/local/mysql -dwith_extra_charsets:string=gbk,gb2312,utf8 -dwith_myisam_storage_engine=1 -dwith_innobase_storage_engine=1 -dwith_readline=1 -denabled_local_infile=1 -dmysql_datadir=/var/mysql-data/    

    增加权限

 

    chmod +w /usr/local/mysql

 

    chown -R mysql:mysql /usr/local/mysql

 

    mkdir -p /var/mysql/mysql-data/

 

    mkdir -p /var/mysql/mysql-log/

 

    chown -R mysql:mysql /var/mysql/

 

    拷贝my.cnf文件

 

    cd support-files/

 

    cp my-large.cnf /opt/mysql/my.cnf (注意:my-large.cnf适用于1G内存左右的服务器,可以根据自己配置情况选用my-large.cnf 或 my-huge.cnf 等不同配置)

 

    cp mysql.server /etc/init.d/mysqld    

    初始化安装

    /usr/local/mysql/scripts/mysql_install_db  --defaults-file=/var/mysql/mysql-data/my.cnf --basedir=/usr/local/mysql --datadir=/var/mysql/mysql-data  --user=mysql

    将mysql加入开启启动

    chmod +x /etc/init.d/mysqld

    vi /etc/init.d/mysqld (如果有特殊目录,编辑此文件,比如基本目录,及数据目录)

    basedir=/usr/local/mysql

    datadir=/var/mysql/mysql-data

    chkconfig --add mysqld

    chkconfig --level 35 mysqld on

    启动mysql

    service mysqld start

    修改root密码

    mysqladmin -u root password "newpwd"

 

----------------------------------------------------------------------  

  安装php
  ./configure --prefix=/usr/local/php/ --with-config-file-path=/usr/local/php/etc/ --with- apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql/ --with-libxml-dir=/usr/local/libxml2/ --with-jpeg-dir=/usr/local/jpeg/ --with-freetype-dir=/usr/local/freetype/ --with-gd=/usr/local/gd/ --with-mcrypt=/usr/local/libmcrypt/ --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-soap --enable- mbstring=all --enable-sockets

  缺少libtool-ltdl

    yum install libtool-ltdl 安装

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

  vi /etc/httpd/httpd.conf
  Addtype application/x-httpd-php .php .phtml
  /usr/local/apache/bin/apachectl start 启动

----------------------------------------------------------------------

  安装Zend加速器
    ./install.sh 界面和windows相似,一路同意

    /usr/local/php/etc/ 指定php配置文件路径
    /usr/local/apache/bin/apachectl 指定启动路径

----------------------------------------------------------------------
  安装phpmyadmin
    cp -R ./phpMyAdmin-3.0.0-rc1-all-languages /usr/local/apache/htdocs/phpMyAdmin
    cp config.sample.inc.php config.inc.php

    vi config.inc.php
    修改 $cfg[‘Servers‘][$i][‘auth_type‘] = ‘http‘;//默认为cookie

(apache2.4.7 php5.4.25 mysql 5.5.23) 编译安装