Apache http server 2.4.48 编译安装方法介绍

第一步:下载Apache http server 源码安装包

[root@localhost ~]# cd /usr/local/src/
[root@localhost src]# wget https://dlcdn.apache.org//httpd/httpd-2.4.48.tar.gz

第二步:解压缩安装包,编译安装

[root@localhost src]# tar zxf httpd-2.4.48.tar.gz 
[root@localhost src]# cd httpd-2.4.48

 进到httpd安装目录后,该怎么进行安装呢?源码包一般会带有INSTALL、README之类的参考安装文档,我们在安装之前可以看一下这些文档。

[root@localhost httpd-2.4.48]# less INSTALL 
  APACHE INSTALLATION OVERVIEW

  Quick Start - Unix
  ------------------

  For complete installation documentation, see [ht]docs/manual/install.html or
  http://httpd.apache.org/docs/2.4/install.html

     $ ./configure --prefix=PREFIX
     $ make
     $ make install
     $ PREFIX/bin/apachectl start

可以看到指导说明:完整的安装文档可以看当前目录下docs/manual/install.html这个文件或者是官方的在线文档http://httpd.apache.org/docs/2.4/install.html

我们打开官方在线文档看下安装说明

Apache http server 2.4.48 编译安装方法介绍

 

 可以看到我们需要GCC、apr、apr-util、pcre等支持,那么我先来安装一下

[root@localhost httpd-2.4.48]# yum -y install gcc gcc-c++ make automake autoconf apr-devel apr-util-devel pcre-devel openssl openssl-devel
[root@localhost httpd-2.4.48]# mkdir -p /apps/httpd
[root@localhost httpd-2.4.48]# ./configure --prefix=/apps/httpd --sysconfdir=/etc/httpd --enable-ssl
[root@localhost httpd-2.4.48]# make -j 2
[root@localhost httpd-2.4.48]# make install

 Apache http server 2.4.48 编译安装方法介绍

 

 至此,已经完成编译安装。

第三步,配置环境

[root@localhost httpd-2.4.48]# echo 'PATH=/apps/httpd/bin:$PATH' > /etc/profile.d/httpd.sh
[root@localhost httpd-2.4.48]# . /etc/profile.d/httpd.sh 

第四步,启动服务,并测试访问

[root@localhost httpd-2.4.48]# apachectl start
[root@localhost httpd-2.4.48]# ps -ef |grep http
root      22814      1  0 11:43 ?        00:00:00 /apps/httpd/bin/httpd -k start
daemon    22815  22814  0 11:43 ?        00:00:00 /apps/httpd/bin/httpd -k start
daemon    22816  22814  0 11:43 ?        00:00:00 /apps/httpd/bin/httpd -k start
daemon    22817  22814  0 11:43 ?        00:00:00 /apps/httpd/bin/httpd -k start
root      22906   2790  0 11:43 pts/0    00:00:00 grep --color=auto http
[root@localhost httpd-2.4.48]# netstat -an|grep -w 80
tcp6       0      0 :::80                   :::*                    LISTEN     
[root@localhost httpd-2.4.48]# 

访问测试

Apache http server 2.4.48 编译安装方法介绍

 

 至此,Apache http server已经正常提供web服务了。

上一篇:leetcode 48 旋转图像


下一篇:NOIP模拟48