天天看點

linux 下安裝apache 快速教程

最近自學linux,看鳥哥的文章。提到了apache,是以在虛拟機redhat 5下安裝了一把,

結合國内外文章寫下快速可行的教程:

-------------------------------------------------------------------------------

系統版本: # cat /etc/redhat-release

Red Hat Enterprise Linux Server release 5.4 (Tikanga)

一 步驟概覽:(摘自apache官網)

Download

<code>$ http://httpd.apache.org/download.cgi</code>

Extract

<code>$ gzip -d httpd-NN.tar.gz $ tar xvf httpd-NN.tar $ cd httpd-NN</code>

Configure

<code>$ ./configure --prefix=PREFIX</code>

Compile

<code>$ make</code>

Install

<code>$ make install</code>

Customize

<code>$ vi PREFIX/conf/httpd.conf</code>

Test

<code>$ PREFIX/bin/apachectl -k start</code>

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 <code>/usr/local/apache2</code>.

--NN 代表版本号,PREFIX指定安裝路徑,不指定的話預設:<code>/usr/local/apache2</code>.

二、系統要求:(不滿足後續安裝會提示錯誤)

APR and APR-Util

Perl-Compatible Regular Expressions Library (PCRE)

三、安裝步驟:(滿足系統要求)

1.解決apr not found問題

   [root@yahootest]# tar -zxf apr-1.4.5.tar.gz

   [root@yahoo apr-1.4.5]#./configure --prefix=/usr/local/apr

   [root@yahoo apr-1.4.5]#make

   [root@yahoo apr-1.4.5]#make install

 2.解決APR-util not found問題

   [root@yahoo test]# tar -zxfapr-util-1.3.12.tar.gz

   [[email protected]]# ./configure --prefix=/usr/local/apr-util-with-apr=/usr/local/apr/bin/apr-1-config

  [root@yahoo apr-util-1.3.12]# make

  [root@yahoo apr-util-1.3.12]# make install

3  ../configure仍提示APR-util notfound,增加--with-apr=/usr/local/apr--with-apr-util=/usr/local/apr-util後出現

configure: error: pcre-config for libpcre not found. PCRE isrequired and available from http://pcre.org/

#./configure –help | grep pcre

--with-pcre=PATH       Use external PCRE library

下載下傳:http://sourceforge.net/projects/pcre

#unzip -o pcre-8.10.zip

#cd pcre-8.10

#./configure --prefix=/usr/local/pcre

#make

#make install

4.編譯Apache

  [root@yahoo httpd-2.3.12-beta]# ./configure--prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util

  --with-pcre=/usr/local/pcre/

  [root@yahoo httpd-2.3.12-beta]# make

  [root@yahoo httpd-2.3.12-beta]# make install

  [root@yahoo httpd-2.3.12-beta]# /usr/local/apache2/bin/apachectlstart

----------------------------

present  by   dylan.

繼續閱讀