您的位置:首页 > 理论基础 > 计算机网络

安装apache httpd2.4

2016-01-01 20:40 761 查看
(1)从http://httpd.apache.org/download.cgi下载httpd-2.4.18.tar.gz包

(2)从http://apr.apache.org/download.cgi下载apr-1.5.2.tar.gz、apr-util-1.5.4.tar.gz包,关于Apache APR,全称Apache
Portable Runtime,Apache可移植运行库,主要为上层的应用程序提供一个可以跨越多操作系统平台使用的底层支持接口库。在早期 的Apache版本中,应用程序本身必须能够处理各种具体操作系统平台的细节,并针对不同的平台调用不同的处理函数。随着Apache的进一步开 发,Apache组织决定将这些通用的函数独立出来并发展成为一个新的项目。官方如下描述:The mission of the Apache Portable Runtime
(APR) project is to create and maintain software libraries that provide a predictable and consistent interface to underlying platform-specific implementations. The primary goal is to provide an API to which software developers may code and be assured of predictable
if not identical behaviour regardless of the platform on which their software is built, relieving them of the need to code special-case conditions to work around or take advantage of platform-specific deficiencies or features.

(3)从ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/下载pcre-8.37.tar.gz包,关于pcre,Perl官方如下描述:The
PCRE library is a set of functions that implement regular expression pattern matching using the same syntax and semantics as Perl 5. PCRE has its own native API, as well as a set of wrapper functions that correspond to the POSIX regular expression API. The
PCRE library is free, even for building proprietary software.

(4)先解压缩各包,安装pcre,再安装httpd

[plain] view
plaincopy

$ gzip -d httpd-2.4.18.tar.gz  

$ tar xvf httpd-2.4.18.tar  

$ gzip -d apr-1.5.2.tar.gz  

$ tar xvf apr-1.5.2.tar  

$ gzip -d apr-util-1.5.4.tar.gz  

$ tar xvf apr-util-1.5.4.tar  

$ mv apr-1.5.2 httpd-2.4.18/srclib/apr  

$ mv apr-util-1.5.4 httpd-2.4.18/srclib/apr-util  

$ gzip -d pcre-8.37.tar.gz  

$ tar xvf pcre-8.37.tar  

$ cd ~/pcre-8.37  

$ ./configure  

$ make && make install  

$ cd ~/httpd-2.4.18  

$ ./configure --prefix=/usr/local/apache2  

$ make && make install  

httpd相关命令在/usr/local/apache2/bin下

配置文件等在/usr/local/apache2/conf下

安装成功后,

执行命令/usr/local/apache2/bin/apachectl start,默认启动端口为80,浏览器访问

  提示

It Works!

官方安装文档

http://httpd.apache.org/docs/2.4/install.html

 


Overview for the impatient

Download
$ lynx http://httpd.apache.org/download.cgi[/code]
Extract
$ gzip -d httpd-NN.tar.gz

$ tar xvf httpd-NN.tar

$ cd httpd-NN
Configure
$ ./configure --prefix=PREFIX
Compile
$ make
Install
$ make install
Customize
$ vi PREFIX/conf/httpd.conf
Test
$ PREFIX/bin/apachectl -k start
NN must be replaced with the current version number, and PREFIX must be replaced with the filesystem path under which the server should be installed. If PREFIX is not specified, it defaults to 
/usr/local/apache2
.

Each section of the compilation and installation process is described in more detail below, beginning with the requirements for compiling and installing Apache httpd.






Requirements

The following requirements exist for building Apache httpd:
APR and APR-UtilMake sure you have APR and APR-Util already installed on your system. If you don't, or prefer to not use the system-provided versions, download the latest versions of both APR and APR-Util from Apache
APR, unpack them into 
/httpd_source_tree_root/srclib/apr
 and
/httpd_source_tree_root/srclib/apr-util
 (be
sure the directory names do not have version numbers; for example, the APR distribution must be under /httpd_source_tree_root/srclib/apr/) and use 
./configure
's 
--with-included-apr
 option.
On some platforms, you may have to install the corresponding 
-dev
 packages to allow httpd to build against your installed copy of APR and APR-Util.Perl-Compatible Regular Expressions Library (PCRE)This library is required but not longer bundled with httpd. Download the source code from http://www.pcre.org,
or install a Port or Package. If your build system can't find the pcre-config script installed by the PCRE build, point to it using the 
--with-pcre
 parameter. On some platforms,
you may have to install the corresponding 
-dev
 package to allow httpd to build against your installed copy of PCRE.Disk SpaceMake sure you have at least 50 MB of temporary free disk space available. After installation the server occupies approximately 10 MB of disk space. The actual disk space requirements will vary considerably based on your chosen
configuration options, any third-party modules, and, of course, the size of the web site or sites that you have on the server.ANSI-C Compiler and Build SystemMake sure you have an ANSI-C compiler installed. The GNU C compiler (GCC) from the Free
Software Foundation (FSF) is recommended. If you don't have GCC then at least make sure your vendor's compiler is ANSI compliant. In addition, your 
PATH
 must contain basic
build tools such as
make
.Accurate time keepingElements of the HTTP protocol are expressed as the time of day. So, it's time to investigate setting some time synchronization facility on your system. Usually the 
ntpdate
 or 
xntpd
 programs
are used for this purpose which are based on the Network Time Protocol (NTP). See the NTP homepage for more details
about NTP software and public time servers.Perl 5 [OPTIONAL]For some of the support scripts like 
apxs
 or 
dbmmanage
 (which
are written in Perl) the Perl 5 interpreter is required (versions 5.003 or newer are sufficient). If no Perl 5 interpreter is found by the 
configure
 script,
you will not be able to use the affected support scripts. Of course, you will still be able to build and use Apache httpd.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: