---
title: "RedHat Linux 中 Apache HTTP Server 安装详解"
author: "brofe"
date: "2013-12-13T14:15:29Z"
tags: []
categories: ["操作系统"]
slug: "redhat-linux-apache-http-server"
draft: false
lastmod: "2013-12-13T14:17:04Z"
id: 1989128
url: "https://brofe.iteye.com/blog/1989128"
---

RedHat Linux Version:
Linux version 2.6.18-308.el5 (mockbuild@x86-007.build.bos.redhat.com) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-50)) #1 SMP Fri Jan 27 17:17:51 EST 2012

echo $PATH (必须先安装JDK，见另外一篇博客:http://brofe.iteye.com/blog/1988590)
/usr/kerberos/sbin:/usr/kerberos/bin:/usr/java/jdk1.6.0_45/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

第一步：下载 Apache HTTP Server ( 我用的是：2.2.26 版本 )，并放在：/usr/software 目录中, software 为自定义目录，为了管理方便而已
下载地址：http://apache.fayea.com/apache-mirror//httpd/httpd-2.2.26.tar.gz
下载后的文件为：httpd-2.2.26.tar.gz

第二步：解压刚下载好的文件

```shell

命令：cd /usr/software  # 进入该目录，因为刚才下载好的文件，放在了这里
命令：gzip -d httpd-2.2.26.tar.gz
命令：tar xvf  httpd-2.2.26.tar # 这里执行完后，会在/usr/software 新出先一个目录为：httpd-2.2.26

```


第三部：配置和编译 Apache

```shell

命令：cd /usr/software/httpd-2.2.26
命令：./configure # 配置，默认路径为：/usr/local/httpd2.2
命令：make # 编译
命令：make install # 安装

```


第四步：启动或停止 Apache

```shell

命令：cd /usr/local/httpd2.2/bin
命令：./apachectl start # 启动Apache，成功可通过浏览器访问地址：http://localhost 如果出现：It works, 表示启动成功
命令：./apachectl restart # 重启Apache
命令：./apachectl stop # 停止Apache

```


至此 Apache HTTP Server 安装全部完成