湖濱散記部落格的樹心幽徑[login][主頁]
248:20120913安裝Apache網頁伺服器


(1)Download httpd-2.4.2.tar.gz
[webadm@dns ~]$ date
四  9月 13 17:37:32 CST 2012
[webadm@dns ~]$ cd lnx
[webadm@dns lnx]$   wget http://apache.stu.edu.tw//httpd/httpd-2.4.2.tar.gz
[webadm@dns lnx]$ ls
apr-1.4.6.tar.gz       httpd-2.4.2.tar.gz     pcre-8.31.tar.gz
apr-util-1.4.1.tar.gz  libapreq2-2.13.tar.gz  php-5.4.5.tar.gz


(2) check previous version
[webadm@dns lnx]$ httpd -v
Server version: Apache/2.2.22 (Unix)
Server built:   Apr 30 2012 09:55:05
[webadm@dns lnx]$ httpd -l
Compiled in modules:
  core.c
  prefork.c
  http_core.c
  mod_so.c
[webadm@dns lnx]$

[webadm@dns lnx]$ whereis httpd
httpd: /sbin/httpd /sbin/httpd.event /sbin/httpd.worker /usr/sbin/httpd /usr/sbin/httpd.event /usr/sbin/httpd.worker /etc/httpd /lib/httpd /usr/lib/httpd /usr/share/man/man8/httpd.8.gz
[webadm@dns lnx]$ whereis apachectl
apachectl: /sbin/apachectl /usr/sbin/apachectl /usr/share/man/man8/apachectl.8.gz
[webadm@dns lnx]$

(3) decompress httpd-2.4.2.tar.gz
[webadm@dns lnx]$ tar xvzf httpd-2.4.2.tar.gz
[webadm@dns lnx]$ cd httpd-2.4.2/
[webadm@dns httpd-2.4.2]$ su
密碼:
[root@dns httpd-2.4.2]# ls
ABOUT_APACHE     BuildBin.dsp   httpd.dsp       Makefile.in       ROADMAP
acinclude.m4     buildconf      httpd.spec      Makefile.win      server
Apache-apr2.dsw  CHANGES        include         modules           srclib
Apache.dsw       config.layout  INSTALL         NOTICE            support
apache_probes.d  configure      InstallBin.dsp  NWGNUmakefile     test
ap.d             configure.in   LAYOUT          os                VERSIONING
build            docs           libhttpd.dsp    README
BuildAll.dsp     emacs-style    LICENSE         README.platforms
[root@dns httpd-2.4.2]#


(4) configure httpd-2.4.2 failure
[root@dns httpd-2.4.2]# ./configure --enable-so --enable-unique-id --prefix=/usr/local/apache2
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu

Configuring Apache Portable Runtime library ...

checking for APR... no
configure: error: APR not found.  Please read the documentation.
[root@dns httpd-2.4.2]#

(5) install apr
[root@dns lnx]# wget http://ftp.twaren.net/Unix/Web/apache//apr/apr-1.4.6.tar.gz

[root@dns lnx]$ tar xvzf apr-1.4.6.tar.gz
[root@dns lnx]# cd apr-1.4.6/

[root@dns apr-1.4.6]# ./configure
:
config.status: executing libtool commands
rm: cannot remove `libtoolT': No such file or directory
config.status: executing default commands

[root@dns apr-1.4.6]# make
[root@dns apr-1.4.6]# make install


(6) install apr-util
[root@dns lnx]# wget http://ftp.twaren.net/Unix/Web/apache//apr/apr-util-1.4.1.tar.gz
[root@dns lnx]# tar xvzf apr-util-1.4.1.tar.gz

[root@dns lnx]# cd apr-util-1.4.1/
[root@dns apr-util-1.4.1]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr

[root@dns apr-util-1.4.1]# make

[root@dns apr-util-1.4.1]# make install

(7) install pcre
[root@dns lnx]# wget http://sourceforge.net/projects/pcre/files/pcre/8.31/pcre-8.31.tar.gz/download
[root@dns lnx]# mv download pcre-8.31.tar.gz
[root@dns lnx]# tar xvzf pcre-8.31.tar.gz
[root@dns lnx]# cd pcre-8.31/
[root@dns pcre-8.31]# ./configure --prefix=/usr/local/pcre
[root@dns pcre-8.31]# make
[root@dns pcre-8.31]# make install

(8) re confiure success and build httpd
[root@dns pcre-8.31]# cd ../httpd-2.4.2/
[root@dns httpd-2.4.2]# ./configure --enable-so --enable-unique-id --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre

[root@dns httpd-2.4.2]# make

[root@dns httpd-2.4.2]# make install

[root@dns httpd-2.4.2]# /usr/local/apache2/bin/httpd -v
Server version: Apache/2.4.2 (Unix)
Server built:   Sep 13 2012 17:55:08
[root@dns httpd-2.4.2]#


(9) excute httpd success
[root@dns httpd-2.4.2]#  /usr/local/apache2/bin/apachectl start
[root@dns httpd-2.4.2]# ps ax |grep httpd
 3453 ?        Ss     0:00 /usr/local/apache2/bin/httpd -k start
 3454 ?        Sl     0:00 /usr/local/apache2/bin/httpd -k start
 3455 ?        Sl     0:00 /usr/local/apache2/bin/httpd -k start
 3456 ?        Sl     0:00 /usr/local/apache2/bin/httpd -k start
 3539 pts/0    S+     0:00 grep --color=auto httpd
[root@dns httpd-2.4.2]#
[root@dns httpd-2.4.2]# date
四  9月 13 17:59:10 CST 2012
[root@dns httpd-2.4.2]#


http://localhost/
:
It works!
----------------------------------------------------------------------------


select id,article_id,topic,text from lt_articles_text where article_id =248; ok. update lt_articles set num_reads=num_reads +1 where id=248; ok.