centos 6.8源码安装Apache

源码安装

1.首先安装相应编译工具: gcc gcc-c++ gcc-g77

[root@localhost src]#  yum install gcc gcc-c++ gcc-g77

在这里插入图片描述 2.分析安装平台

centos6.8 还是7.0 等

3下载源码包:

源码包:
①http://mirror.bit.edu.cn/apache/httpd/httpd-2.4.41.tar.gz
②http://mirror.bit.edu.cn/apache/apr/apr-1.6.5.tar.gz
③http://mirror.bit.edu.cn/apache/apr/apr-util-1.6.1.tar.gz
④https://ftp.pcre.org/pub/pcre/pcre-8.44.tar.gz

官方站点网址:获取源码包网址: http://mirror.bit.edu.cn/apache/aprapr
建议保存位置:usr/local/src

编译安装程序源码包步骤

1、./configure 软件配置和系统检查

	  	 a.指定安装路径 --prefix=/usr/local/apache
	  	 b.启用禁用功能  --enable-ssl
	  	 c.与其他软件关联 --with-apr =          
	  	 4.检查
	  	 定义好的功能和检测的安装环境信息写入到 makefile文件中,

2、 make
3、 make install

出错:
注意:如果make出错 需要执行 make clean 并且最好重新 ./configure

安装完成后启动服务

[root@localhost src]# cd /usr/local/                    //切换到local目录下
[root@localhost local]# ls
apache  apr  apr-util  bin  etc  games  include  lib  lib64  libexec  pcre  prce  sbin  share  src
[root@localhost local]# cd apache/                     //切换到 apache目录下
[root@localhost apache]# ls
bin  build  build-1  cgi-bin  conf  error  htdocs  icons  include  lib  logs  man  manual  modules          share
[root@localhost apache]# cd bin/                         //切换到bin目录下
[root@localhost bin]# ./apachectl start                //重启
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using     localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
[root@localhost bin]# curl 192.168.253.128                    //cure 地址
<html><body><h1>It works!</h1></body></html>

出错:
注意:网址打不开 关闭防火墙执行命令

[root@localhost bin]# iptables -F

安装Apache具体步骤
1.首先安装相应编译工具: gcc gcc-c++ gcc-g77

安装wget
在这里插入图片描述
源码包建议保存位置:usr/local/src

[root@localhost ~]# cd /usr/local/src/

下载httpd及压缩httpd
在这里插入图片描述
编译 报错
在这里插入图片描述
下载apr压缩apr
在这里插入图片描述
编译apr: 安装
在这里插入图片描述

[root@localhost apr-1.6.5]# make && make install         //安装apr

下载压缩编译安装apr-util

[root@localhost apr-1.6.5]# cd ..           
[root@localhost src]# wget http://mirror.bit.edu.cn/apache/apr/apr-util-1.6.1.tar.gz        //下载apr-util
[root@localhost src]# ls
apr-1.6.5  apr-1.6.5.tar.gz  apr-util-1.6.1.tar.gz  httpd-2.4.41  httpd-2.4.41.tar.gz
root@localhost src]# tar -xzvf  apr-util-1.6.1.tar.gz          //压缩apr-util

[root@localhost src]# cd  apr-util-1.6.1
[root@localhost apr-util-1.6.1]# ./configure --prefix=/usr/local/apr-util --with-apr=/us                      r/local/apr   //指定路径 with关联
[root@localhost apr-util-1.6.1]# make && make install         //安装apr-util

出错:
注意: make时 后出错
执行#yum install expat-devel -y
# make clean
# 从.configure开始重新编译
下载pcre

在这里插入图片描述
编译pcre安装
在这里插入图片描述

 [root@localhost pcre-8.44]# make && make install         //安装pcre

编译安装Apache
在这里插入图片描述
[root@localhost httpd-2.4.41]# make && make install
安装完成后启动服务

[root@localhost src]# cd /usr/local/                    //切换到local目录下
[root@localhost local]# ls
apache  apr  apr-util  bin  etc  games  include  lib  lib64  libexec  pcre  prce  sbin  share  src
[root@localhost local]# cd apache/                     //切换到 apache目录下
[root@localhost apache]# ls
bin  build  build-1  cgi-bin  conf  error  htdocs  icons  include  lib  logs  man  manual  modules          share
[root@localhost apache]# cd bin/                         //切换到bin目录下
[root@localhost bin]# ./apachectl start                //重启
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using     localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
[root@localhost bin]# curl 192.168.253.128                    //cure 地址
<html><body><h1>It works!</h1></body></html>

出错:
注意:网址打不开 关闭防火墙执行命令
[root@localhost bin]# iptables -F
测试:
在这里插入图片描述
完成!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值