compile httpd 2.4.9, perl, php in CentOS 6.x x64

httpd 2.4.9 在CentOS 6.x x64上的安装过程.

一. apr安装
# wget
# tar -jxvf apr-1.5.1.tar.bz2
# cd apr-1.5.1
# ./configure --prefix=/opt/apr1.5.1
# make && make test
# make install

[root@dba apr-1.5.1]# vi /etc/
[root@dba apr-1.5.1]# ldconfig
[root@dba apr-1.5.1]# ldconfig -p|grep apr (libc6,x86-64) => /usr/lib64/ (libc6,x86-64) => /usr/lib64/ (libc6,x86-64) => /opt/arp1.5.1/lib/ (libc6,x86-64) => /usr/lib64/ (libc6,x86-64) => /opt/arp1.5.1/lib/

# vi /etc/profile
export PATH=/opt/apr1.5.1/bin:$PATH

二. 安装apr-iconv
# wget
# tar -jxvf apr-iconv-1.2.1.tar.bz2 
# cd apr-iconv-1.2.1
# ./configure --prefix=/opt/apr-iconv1.2.1 --with-apr=/opt/apr1.5.1/bin/apr-1-config
# make && make install

# vi /etc/profile
# export PATH=/opt/apr-iconv1.2.1/bin:/opt/apr1.5.1/bin:$PATH

# vi /etc/
# ldconfig
[root@dba bin]# ldconfig -p|grep iconv (libc6,x86-64) => /opt/apr-iconv1.2.1/lib/ (libc6,x86-64) => /opt/apr-iconv1.2.1/lib/

三. 安装apr-util
# wget
# tar -jxvf apr-util-1.5.3.tar.bz2
# cd apr-util-1.5.3
# ./configure --prefix=/opt/apr-util1.5.3 --with-apr=/opt/apr1.5.1/bin/apr-1-config --with-apr-iconv=/opt/apr-iconv1.2.1/bin/apriconv --with-crypto --with-pgsql=/opt/pgsql
# vi /etc/
# ldconfig
[root@dba apr-util-1.5.3]# ldconfig -p|grep apr-util (libc6,x86-64) => /opt/apr-util1.5.3/lib/ (libc6,x86-64) => /opt/apr-util1.5.3/lib/ (libc6,x86-64) => /opt/apr-util1.5.3/lib/ (libc6,x86-64) => /opt/apr-util1.5.3/lib/

# vi /etc/profile
export PATH=/opt/apr-util1.5.3/bin:/opt/apr-iconv1.2.1/bin:/opt/apr1.5.1/bin:$PATH

四. pcre安装
# wget
# tar -jxvf pcre-8.35.tar.bz2
# cd pcre-8.35
# ./configure --prefix=/opt/pcre-8.35 --enable-utf8 --enable-unicode-properties --enable-pcretest-libreadline --enable-shared --enable-static --enable-jit --enable-pcre16 --enable-pcre32
# make && make install

[root@dba ~]# /opt/pcre-8.35/bin/pcretest -C
PCRE version 8.35 2014-04-04
Compiled with
  8-bit support
  UTF-8 support
  Unicode properties support
  No just-in-time compiler support
  Newline sequence is LF
  \R matches all Unicode newlines
  Internal link size = 2
  POSIX malloc threshold = 10
  Parentheses nest limit = 250
  Default match limit = 10000000
  Default recursion depth limit = 10000000
  Match recursion uses stack

# vi /etc/profile
export PATH=/opt/pcre-8.35/bin:/opt/apr-util1.5.3/bin:/opt/apr-iconv1.2.1/bin:/opt/apr1.5.1/bin:$PATH
export MANPATH=/opt/pcre-8.35/share/man:$MANPATH

# vi /etc/

# ldconfig

[root@dba pcre-8.35]# ldconfig -p|grep pcre (libc6,x86-64) => /opt/pcre-8.35/lib/ (libc6,x86-64) => /usr/lib64/ (libc6,x86-64) => /opt/pcre-8.35/lib/ (libc6,x86-64) => /opt/pcre-8.35/lib/ (libc6,x86-64) => /usr/lib64/ (libc6,x86-64) => /opt/pcre-8.35/lib/ (libc6,x86-64) => /opt/pcre-8.35/lib/ (libc6,x86-64) => /lib64/ (libc6,x86-64) => /opt/pcre-8.35/lib/

五. 配置时间同步
# crontab -e
8 * * * * /usr/sbin/ntpdate && /sbin/hwclock --systohc

# /usr/sbin/ntpdate && /sbin/hwclock --systohc
17 Jul 09:19:26 ntpdate[5435]: adjust time server offset -0.109806 sec

六. perl安装
# wget
# tar -xzf perl-5.20.0.tar.gz
# cd perl-5.20.0
# ./Configure --help
Usage: Configure [-dehrsEKOSV] [-f] [-D symbol] [-D symbol=value]
                 [-U symbol] [-U symbol=] [-A command:symbol...]
  -d : use defaults for all answers.
  -e : go on without questioning past the production of
  -f : specify an alternate default configuration file.
  -h : print this help message and exit (with an error status).
  -r : reuse C symbols value if possible (skips costly nm extraction).
  -s : silent mode, only echoes questions and essential information.
  -D : define symbol to have some value:
         -D symbol         symbol gets the value 'define'
         -D symbol=value   symbol gets the value 'value'
       common used examples (see INSTALL for more info):
         -Duse64bitint            use 64bit integers
         -Duse64bitall            use 64bit integers and pointers
         -Dusethreads             use thread support
         -Dinc_version_list=none  do not include older perl trees in @INC
         -DEBUGGING=none          DEBUGGING options
         -Dcc=gcc                 choose your compiler
         -Dprefix=/opt/perl5      choose your destination
  -E : stop at the end of questions, after having produced
  -K : do not use unless you know what you are doing.
  -O : let -D and -U override definitions from loaded configuration file.
  -S : perform variable substitutions on all .SH files (can mix with -f)
  -U : undefine symbol:
         -U symbol    symbol gets the value 'undef'
         -U symbol=   symbol gets completely empty
       e.g.:  -Uversiononly
  -A : manipulate symbol after the platform specific hints have been applied:
         -A append:symbol=value   append value to symbol
         -A symbol=value          like append:, but with a separating space
         -A define:symbol=value   define symbol to have value
         -A clear:symbol          define symbol to be ''
         -A define:symbol         define symbol to be 'define'
         -A eval:symbol=value     define symbol to be eval of value
         -A prepend:symbol=value  prepend value to symbol
         -A undef:symbol          define symbol to be 'undef'
         -A undef:symbol=         define symbol to be ''
       e.g.:  -A prepend:libswanted='cl pthread '
              -A ccflags=-DSOME_MACRO
  -V : print version number and exit (with a zero status).

# ./Configure -Duseshrplib -des -Dprefix=/opt/perl5.20.0
# make && make test
# make install

# vi /etc/profile
export PATH=/opt/perl5.20.0/bin:/opt/pcre-8.35/bin:/opt/apr-util1.5.3/bin:/opt/apr-iconv1.2.1/bin:/opt/apr1.5.1/bin:$PATH
export MANPATH=/opt/perl5.20.0/man:/opt/pcre-8.35/share/man:$MANPATH

[root@dba ~]# which perl

七. 安装httpd

# wget

# tar -jxvf httpd-2.4.9.tar.bz2
# cd httpd-2.4.9

# vi /etc/profile
export PATH=/opt/httpd2.4.9/bin:/opt/perl5.20.0/bin:/opt/pcre-8.35/bin:/opt/apr-util1.5.3/bin:/opt/apr-iconv1.2.1/bin:/opt/apr1.5.1/bin:$PATH
export MANPATH=/opt/httpd2.4.9/man:/opt/perl5.20.0/man:/opt/pcre-8.35/share/man:$MANPATH

八. 配置httpd, 略

九. 启动httpd
# apachectl start

1. php安装

yum install -y libpng libpng-devel
tar -jxvf php-5.5.14.tar.bz2
cp /opt/pcre-8.35/include/pcre.h /opt/pcre-8.35/lib/
cd php5.5.14
./configure --prefix=/opt/php5.5.14 --with-pcre-regex=/opt/pcre-8.35/lib --enable-fpm --enable-opcache --with-pdo-pgsql=/opt/pgsql/bin --with-pgsql=/opt/pgsql/bin --with-gd --enable-mbstring
make install

vi /etc/profile
export PATH=/opt/php5.5.14/bin:/opt/php5.5.14/sbin:/opt/httpd2.4.9/bin:/opt/pcre-8.35/bin:/opt/apr-util1.5.3/bin:/opt/apr-iconv1.2.1/bin:/opt/perl5.20.0/bin:/opt/apr1.5.1/bin:$PATH
export MANPATH=/opt/php5.5.14/php/man:/opt/httpd2.4.9/man:/opt/perl5.20.0/man:/opt/pcre-8.35/share/man:$MANPATH

2. httpd的使用, 参考
例如虚拟主机的配置, 安全配置, 配置文件详解等.
如果有多个域名, 可以使用name based 虚拟主机, 如果有多个IP+端口的组合, 可以使用ip based 虚拟主机.
例如1 :
例如2 :
用name based的虚拟主机配置.
当然, 你也可以使用多个httpd进程来代替单个httpd进程管理的多虚拟主机.

前端开发 JavaScript Shell
当然,我是直接在服务器上下载的: bash 复制代码
54 1
小程序 JavaScript Shell
34 1
351 0
Linux PHP
Linux PHP Apache
3079 0
测试技术 Apache PHP