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

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

一. apr安装
http://apr.apache.org/download.cgi
# wget http://mirror.bit.edu.cn/apache//apr/apr-1.5.1.tar.bz2
# 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/ld.so.conf
/opt/apr1.5.1/lib
[root@dba apr-1.5.1]# ldconfig
[root@dba apr-1.5.1]# ldconfig -p|grep apr
        libgstdataprotocol-0.10.so.0 (libc6,x86-64) => /usr/lib64/libgstdataprotocol-0.10.so.0
        libaprutil-1.so.0 (libc6,x86-64) => /usr/lib64/libaprutil-1.so.0
        libapr-1.so.0 (libc6,x86-64) => /opt/arp1.5.1/lib/libapr-1.so.0
        libapr-1.so.0 (libc6,x86-64) => /usr/lib64/libapr-1.so.0
        libapr-1.so (libc6,x86-64) => /opt/arp1.5.1/lib/libapr-1.so

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


二. 安装apr-iconv
# wget http://mirrors.hust.edu.cn/apache//apr/apr-iconv-1.2.1.tar.bz2
# 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/ld.so.conf
/opt/apr-iconv1.2.1/lib
# ldconfig
[root@dba bin]# ldconfig -p|grep iconv
        libapriconv-1.so.0 (libc6,x86-64) => /opt/apr-iconv1.2.1/lib/libapriconv-1.so.0
        libapriconv-1.so (libc6,x86-64) => /opt/apr-iconv1.2.1/lib/libapriconv-1.so


三. 安装apr-util
# wget http://mirrors.hust.edu.cn/apache//apr/apr-util-1.5.3.tar.bz2
# 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/ld.so.conf
/opt/apr-util1.5.3/lib
# ldconfig
[root@dba apr-util-1.5.3]# ldconfig -p|grep apr-util
        libexpat.so.0 (libc6,x86-64) => /opt/apr-util1.5.3/lib/libexpat.so.0
        libexpat.so (libc6,x86-64) => /opt/apr-util1.5.3/lib/libexpat.so
        libaprutil-1.so.0 (libc6,x86-64) => /opt/apr-util1.5.3/lib/libaprutil-1.so.0
        libaprutil-1.so (libc6,x86-64) => /opt/apr-util1.5.3/lib/libaprutil-1.so

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


四. pcre安装
http://www.pcre.org/
# wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.35.tar.bz2
# 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/ld.so.conf
/opt/pcre-8.35/lib

# ldconfig

[root@dba pcre-8.35]# ldconfig -p|grep pcre
        libpcreposix.so.0 (libc6,x86-64) => /opt/pcre-8.35/lib/libpcreposix.so.0
        libpcreposix.so.0 (libc6,x86-64) => /usr/lib64/libpcreposix.so.0
        libpcreposix.so (libc6,x86-64) => /opt/pcre-8.35/lib/libpcreposix.so
        libpcrecpp.so.0 (libc6,x86-64) => /opt/pcre-8.35/lib/libpcrecpp.so.0
        libpcrecpp.so.0 (libc6,x86-64) => /usr/lib64/libpcrecpp.so.0
        libpcrecpp.so (libc6,x86-64) => /opt/pcre-8.35/lib/libpcrecpp.so
        libpcre.so.1 (libc6,x86-64) => /opt/pcre-8.35/lib/libpcre.so.1
        libpcre.so.0 (libc6,x86-64) => /lib64/libpcre.so.0
        libpcre.so (libc6,x86-64) => /opt/pcre-8.35/lib/libpcre.so


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

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


六. perl安装
http://www.perl.org/get.html#unix_like
# wget http://www.cpan.org/src/5.0/perl-5.20.0.tar.gz
# tar -xzf perl-5.20.0.tar.gz
# cd perl-5.20.0
# ./Configure --help
Usage: Configure [-dehrsEKOSV] [-f config.sh] [-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 config.sh.
  -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 config.sh.
  -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
/opt/perl5.20.0/bin/perl


七. 安装httpd
http://httpd.apache.org/docs/2.4/install.html
http://wiki.apache.org/httpd/DistrosDefaultLayout

# wget http://mirrors.cnnic.cn/apache//httpd/httpd-2.4.9.tar.bz2

# 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, 略
http://httpd.apache.org/docs/2.4/en/configuring.html

九. 启动httpd
# apachectl start


[其他]
1. php安装

yum install -y libpng libpng-devel
wget http://cn2.php.net/get/php-5.5.14.tar.bz2/from/this/mirror
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
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的使用, 参考  http://httpd.apache.org/docs/current/en/
例如虚拟主机的配置, 安全配置, 配置文件详解等.
如果有多个域名, 可以使用name based 虚拟主机, 如果有多个IP+端口的组合, 可以使用ip based 虚拟主机.
例如1 : 
dba.sky-mobi.com:80
dba.sky-mobi.com:81
用ip+端口的虚拟主机配置.
例如2 : 
dba1.sky-mobi.com
dba2.sky-mobi.com
用name based的虚拟主机配置.
当然, 你也可以使用多个httpd进程来代替单个httpd进程管理的多虚拟主机.

[参考]
相关文章
|
3月前
|
前端开发 JavaScript Shell
centos编译安装PHP(1)
当然,我是直接在服务器上下载的: bash 复制代码
54 1
|
3月前
|
小程序 JavaScript Shell
centos编译安装PHP(2)
Php编译安装成功之后,是没有php.ini文件的,需要我们从源码包中复制过去。
34 1
QGS
(Centos7-x86)编译安装php-7.4
记(Centos7-x86)编译安装php-7.4
QGS
351 0
(Centos7-x86)编译安装php-7.4
|
Linux PHP
|
Linux PHP Apache
CentOS7.X安装php-7.x.x
CentOS7.X安装php-7.x.x
3079 0
|
测试技术 Apache PHP