CentOS安裝Apache

http://www.cnblogs.com/kgdxpr/archive/2013/01/11/2856033.html


先去網上下載四個文件

1、apr-1.4.6.tar.gz

2、apr-util-1.5.1.tar.gz

3、pcre-8.32.tar.gz

4、httpd-2.4.3.tar.gz

這些都是安裝Apache必須的文件,而且很好下載。

http://pan.baidu.com/share/link?shareid=169366&uk=1829018343

這個是我上傳的,截至到2013-01-10日這些文件都是最新的版本


1、 apr-1.4.6.tar.gz

tar xzf apr-1.4.6.tar.gz

./configure –prefix=/usr/local/apr

make && make install


2、 apr-util-1.5.1.tar.gz

tar xzf apr-util-1.5.1.tar.gz

.configure –with-apr=/usr/local/apr

make && make install


3、 prce

tar xzf pcre-8.32.tar.gz

./configure –prefix=/usr/local/prce

make && make install

(如果上面安裝過程出現/bin/rm: cannot remove `libtoolT’: No such file or directory這個問題,解決辦法 vi configure 找到$RM “$cfgfile”這行刪掉)

安裝pcre報錯“You need a C++ compiler for C++ support.”解決辦法

yum install -y gcc gcc-c++

4、 apache

tar xzf httpd-2.4.3.tar.gz

./configure -prefix=/usr/local/apache --with-apr=/usr/local/apr/ --with-pcre=/usr/local/pcre/

make && make install

檢查一下apache是否正確安裝

/usr/local/apache/bin/apachectl -t

(出現AH00557: httpd: apr_sockaddr_info_get() failed for Chunk3這個問題,解決辦法, vi /usr/local/apache/conf/httpd.conf 找到#ServerName www.example.com:80 這行,把註釋拿掉,然後改成ServerName localhost:80)

啓動apache

service httpd start

(出現httpd: unrecognized service這個問題,解決辦法

#cd /usr/local/apache/bin/

#cp apachectl /etc/rc.d/init.d/httpd

#vi /etc/rc.d/init.d/httpd

在#!/bin/sh這行下增加

# chkconfig: 2345 50 90

# description:Activates/Deactivates Apache Web Server)


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章