Apache的提取、编译与安装

 

在linux下的软件的安装并不看windows下那么简单,要经过一系列的指令才能完成安装。

 

Ubuntu的默认下载路径是/root/Downloads,要通过命令的方式先进入这个路径,找到apache的压缩文件才能进行安装工作。以下是按顺序的相关linux命令:

 

cd /root/Downloads

 

tar xzf httpd-2.2.22.tar.gz  //提取后会生成httpd-2.2.22文件夹

 

cd httpd-2.2.22  //进入httpd-2.2.22文件夹

 

./configure --prefix=/usr/local/apache --enable-so --enable-proxy --enable-proxy-http --enable-proxy-balancer --enable-modules=all --enable-mods-shared=all   //指定安装路径为/usr/local/apache,后面的参数为要编译加载入内核的模块

 

make  

 

make install  //安装

 

三、检查是否成功安装

 

cd /usr/local/apache/modules

 

四、启动

shell>cd /usr/local/apache
shell>bin/apachectl start 启动web服务
shell>bin/apachectl stop 停止web服务
shell>cp bin/apachectl /etc/init.d/httpd
shell>/etc/init.d/httpd restart

apache设为linux服务

 

cp /usr/local/apache2/bin/apachectl /etc/init.d/httpd
vi /etc/init.d/httpd

 

在在#!/bin/sh后面加入下面两行
#chkconfig:345 85 15
#description: Start and stops the Apache HTTP Server.

 

然后
chmod x /etc/rc.d/init.d/httpd
chkconfig --add httpd
 
注:在启动时报httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName此异常
进入apache的安装目录:
linux : /usr/local/apache/conf       打开httpd.conf
将里面的#ServerName localhost:80注释去掉即可。
再执行httpd
然后可以通过浏览器访问http://localhost:80,如果页面显示“It works!”,即表示apache已安装并启动成功。
如果提示using localhost.localdomain for ServerName  说不能确认服务器完全确认域名 localhost.localdoman 
那么修改此文件:
vi /etc/httpd/conf/httpd.conf   加入一句  ServerName  localhost:80
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值