linux 下安装 apache

cd /usr

mkdir Tool

cd Tool

mkdir http

./configure --prefix=/usr/local/apache2 --enable-module=so

make
make install 
出现error :path$ error

查原因是没装gcc 编译器 在安装光盘里面找到如下rpm

gcc-4.1.2-48.el5.x86_64.rpm

gcc-c++-4.1.2-48.el5.x86_64.rpm

glibc-devel-2.5-49.x86_64.rpm

glibc-headers-2.5-49.x86_64.rpm

kernel-headers-2.6.25-128.1.6.el5.binp.x86_64.rpm

libgomp-4.3.2-7.el5.x86_64.rpm

libstdc++-devel-4.1.2-48.el5.x86_64.rpmi

install

kernel-headers-2.6.25-128.1.6.el5.binp.x86_64.rpm

glibc-headers-2.5-49.x86_64.rpm

glibc-devel-2.5-49.x86_64.rpm

libgomp-4.3.2-7.el5.x86_64.rpm

gcc-4.1.2-48.el5.x86_64.rpm

libstdc++-devel-4.1.2-48.el5.x86_64.rpm

gcc-c++-4.1.2-48.el5.x86_64.rpm

后重新安装apache

./configure --prefix=/usr/local/apache2 --enable-module=so

make
make install 
ok

注册apache 为系统服务:

首先将apachectl命令拷贝至/etc/rc.d/init.d目录下,改名为httpd

使用编辑器打开httpd文件,并在第一行#!/bin/sh下增加两行文字如下

# chkconfig: 35 70 30
# description: Apache

接着注册该服务

chkconfig --add httpd

一切OK了,启动服务

service httpd start

其中所增加的第二行中三个数字第一个表示在运行级别3和5下启动apache,第二、三是关于启动和停止的优先级配置,无关紧要
不注册服务则启动命令为 /usr/local/httpd/bin/apachectl start

设置http 为 开机启动

chkconfig httpd on

查看状态

chkconfig --list httpd

在web浏览器打入部署了apache的ip


 

练一技,修百艺,而成于自然.
原文地址:https://www.cnblogs.com/xwj1985/p/2105749.html