源码安装
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
测试:
完成!