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进程管理的多虚拟主机.

[参考]
目录
相关文章
|
4月前
|
Linux 网络安全 Apache
Centos下操作Apache httpd
Centos下操作Apache httpd
111 0
|
4月前
|
Linux 应用服务中间件 网络安全
CentOS7搭建本地离线局域网yum源(Httpd/Nginx+yum)
CentOS7搭建本地离线局域网yum源(Httpd/Nginx+yum)
1211 0
|
10月前
|
Linux PHP
centos7 httpd 多站点部署
centos7 httpd 多站点部署
41 0
|
Linux 应用服务中间件 Apache
Centos7下Httpd最新版本安装
Centos7下Httpd最新版本安装
382 0
|
关系型数据库 MySQL 应用服务中间件
在Centos7上将Apache(httpd)切换为Nginx的过程记录
近期要上线几个基于tornado+motor的移动端接口服务,众所周知,Apache和tornado天生八字不合,尤其apache对python3尤为的不友好,tornado和nginx才是木石前盟,另外由于apache目前系统占用确实比较高,不光进程数多,httpd竟然占用了200多M,太庞大,决定换为较轻量级,高并发的nginx。
在Centos7上将Apache(httpd)切换为Nginx的过程记录
|
前端开发 Linux Apache
Linux CentOS7 httpd 服务配置注释
Linux CentOS7 httpd 服务配置注释 apache 配置注释如果没看懂可以去看看官方发布的文档 apache官方文档 conf/httpd.conf CopyServerRoot "/etc/httpd" # 指定服务配置根目录Listen 80 # 监听端口Include conf.
3058 0
|
Apache 数据安全/隐私保护 Linux
Centos 7 安装Apache httpd
首选,登录您的服务器。输入账号和密码登录后。 1、安装Apache(输入下面命令)yum -y install httpd 2、等待安装完成后,输入启动命令systemctl start httpd 3.
1936 0
|
Web App开发 测试技术 Apache
CentOS6.5环境下搭建Apache httpd服务器
CentOS6.5环境下搭建Apache httpd服务器 前期准备: 1、CentOS6.5虚拟系统; 2、CentOS6.5 IP地址:192.168.2.99 3、虚拟系统能上外网 下面我们就开始配置: 第一步:安装 首先我们需要把Apache httpd服务器安装在我们的CentOS6.
3736 0
下一篇
云函数