linux下httpd软件的编译安装

第一次写博客,就拿今天刚刚学习的编译安装热热身。

首先先了解一下编译安装的进本步骤     注意:可以仔细阅读README和 INSTALL文件的信息,了解有关副

INSTALL文件里说明的步骤
    $ ./configure --prefix=PREFIX
    $ make
    $ make install
    $ PREFIX/bin/apachectl start

以httpd软件为例。

1.首先获得

httpd-2.4.4.tar.gz  

apr-1.5.0.tar.gz      

pcre-8.21.tar.bz2
apr-util-1.5.3.tar.gz

可以从 www.apache.org 下载得到

2.解压
[root@localhost http]# tar xf httpd-2.4.9.tar.bz2
3.安装
[root@localhost httpd-2.4.4]# ./configure --help 可以查看你需要那些功能,以更好的满足你的需求
[root@localhost httpd-2.4.9]# ./configure --prefix=/usr/local/ --enable-so --enable-cache
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
configure:
configure: Configuring Apache Portable Runtime library...
configure:
checking for APR... no
configure: error: APR not found.  Please read the documentation.
此时缺少APR包,缺什么就装什么

[root@localhost http]# tar xf apr-1.5.0.tar.gz

[root@localhost apr-1.5.0]# ./configure --prefix=/usr/local/apr
[root@localhost apr-1.5.0]# make
[root@localhost apr-1.5.0]# make install

再次进入http-2.4.9的文件夹进行编译
[root@localhost httpd-2.4.9]# ./configure --prefix=/usr/local/ --enable-so --enable-cache
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
configure:
configure: Configuring Apache Portable Runtime library...
configure:
checking for APR... yes
 setting CC to "gcc"
 setting CPP to "gcc -E"
 setting CFLAGS to " -g -O2 -pthread"
 setting CPPFLAGS to " -DLINUX -D_REENTRANT -D_GNU_SOURCE"
 setting LDFLAGS to " "
configure:
configure: Configuring Apache Portable Runtime Utility library...
configure:
checking for APR-util... no
configure: error: APR-util not found.  Please read the documentation.
此时缺少APR-util包,缺什么装什么

[root@localhost http]# tar  xf apr-util-1.5.3.tar.gz

[root@localhost apr-util-1.5.3]# ./configure --with-apr=/usr/local/apr/ 此处需要注意选项
[root@localhost apr-util-1.5.3]# make

[root@localhost apr-util-1.5.3]# make install

再次进入http-2.4.9安装

[root@localhost httpd-2.4.9]# ./configure --prefix=/usr/local/ --enable-so --enable-cache

出现了这种错误

/apache --enable-cache --enable-so
......
configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/


此时需要安装pcre-8.21.tar.bz2

[root@localhost httpd]# tar xf pcre-8.21.tar.bz2

[root@localhost pcre-8.21]# ./configure
[root@localhost pcre-8.21]# make ;make install
libtool: compile: unrecognized option `-DHAVE_CONFIG_H‘
libtool: compile: Try `libtool --help‘ for more information.
make[1]: *** [pcrecpp.lo] 错误 1
make[1]: Leaving directory `/meng/httpd/pcre-8.21‘
make: *** [all] 错误 2
source=‘pcrecpp.cc‘ object=‘pcrecpp.lo‘ libtool=yes \
       DEPDIR=.deps depmode=none /bin/sh ./depcomp \
       /bin/sh ./libtool --tag=CXX   --mode=compile  -DHAVE_CONFIG_H -I.      -c -o pcrecpp.lo pcrecpp.cc
libtool: compile: unrecognized option `-DHAVE_CONFIG_H‘
libtool: compile: Try `libtool --help‘ for more information.
make: *** [pcrecpp.lo] 错误 1
[root@localhost pcre-8.21]# yum install gcc-c++
再来一次
[root@localhost httpd]# rm -rf pcre-8.21
[root@localhost httpd]# tar xf pcre-8.21.tar.bz2
[[root@localhost pcre-8.21]# ./configure [root@localhost pcre-8.21]# make ;make install


[root@localhost httpd-2.4.9]# ./configure --prefix=/usr/local/apache --enable-so         --enable-cache

总算成功了

[root@localhost httpd-2.4.9]# make;make install  安装成功



[root@localhost httpd-2.4.9]# vim /usr/local/apache/conf/httpd.conf
189G

ServerName www.feng.com:80 去掉#,增加域名

[root@localhost httpd-2.4.9]# /usr/local/bin/apachectl start   启动httpd服务

体验

用elinks 或者firefox输入自己的IP地址 登入自己的服务器。







本文出自 “mylinux” 博客,请务必保留此出处http://8743589.blog.51cto.com/8733589/1381608

linux下httpd软件的编译安装,布布扣,bubuko.com

linux下httpd软件的编译安装

上一篇:对hibernate运行原理的总结


下一篇:[翻译]清理Linux磁盘空间的4种方法