CentOS 安装apache 及所需的 apr,apr-util,pcre

安装apache前确定已安装 aprapr-utilpcre

一、安装apr

  1. [root@xt test]# tar -zxf apr-1.4.5.tar.gz  
  2. [root@xt test]# cd  apr-1.4.5  
  3. [root@xt apr-1.4.5]# ./configure --prefix=/usr/local/apr  
  4. [root@xt apr-1.4.5]# make && make install  
  5.  

 二、安装apr-util

  1. [root@xt test]# tar -zxf apr-util-1.3.12.tar.gz  
  2. [root@xt test]# cd apr-util-1.3.12  
  3. [root@xt apr-util-1.3.12]# ./configure --prefix=/usr/local/apr-util -with- apr=/usr/local/apr/bin/apr-1-config  
  4. [root@xt apr-util-1.3.12]# make && make install 

 三、安装pcre

  1. [root@xt test]#unzip -o pcre-8.10.zip  
  2. [root@xt test]#cd pcre-8.10  
  3. [root@xt pcre-8.10]#./configure --prefix=/usr/local/pcre  
  4. [root@xt pcre-8.10]#make && make install 

**最后编译Apache时加上:

--with-apr=/usr/local/apr \

--with-apr-util=/usr/local/apr-util/ \

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

 

四、安装apache

1. 下载httpd-2.2.9.tar.gz 源码安装包 
2.  #tar  -zxvfhttpd-2.2.9.tar 
  解压安装包,之后会出现 httpd-2.2.9 的文件夹,进入该文件夹。 
3.进入文件后: 
./configure --prefix=/usr/local//apache --with-apr=/usr/local/apr \

--with-apr-util=/usr/local/apr-util/ \

 --with-pcre=/usr/local/pcre  --enable-so

设置安装目录和参数设置 
4. make 
5. make install 
6:/usr/local/apache/bin/apachectl start ,该命令用来启用apache。 
7. /usr/local/apache/bin/apachectl stop   
此时完成apache的安装 

 

 

 

 

注:

 

一、问题apache启动错误"httpd:Could not reliably determine..."

启动apache遇到错误:httpd: Could not reliably determine the server's fully qualifieddomain name
[root@server httpd-2.2.4]# /usr/local/apache/bin/apachectl start
 
httpd: Could not reliably determine the server's fully qualified domain name,using 127.0.0.1 for ServerName
 
1)进入apache的安装目录:(视个人安装情况而不同) [root@server ~]# cd /usr/local/apache/conf
 
2)编辑httpd.conf文件,搜索"#ServerName",添加ServerName localhost:80
[root@server conf]# ls
extra  httpd.conf  magic  mime.types  original
[root@server conf]# vi httpd.conf
#ServerName www.example.com:80
ServerName localhost:80
3)再重新启动apache 即可。
[root@server ~]# /usr/local/apache/bin/apachectl restart

 

 

无法启动:

(13)Permission denied: AH00072: make_sock:could not bind to address [::]:80

(13)Permission denied: AH00072: make_sock:could not bind to address 0.0.0.0:80

no listening sockets available, shuttingdown

AH00015: Unable to open logs

切换到root,启动

 

你可能感兴趣的:(apache,安装,apr,apr-ut)