cnq 发表于 2018-11-26 11:18:18

apache安装步骤(redhat)

  检查
1.检查apache安装情况
# rpm -qa | grep apache
# rpm -qa | grep http
system-config-httpd-1.3.3.3-1.el5
httpd-devel-2.2.3-22.el5.centos.2
httpd-2.2.3-22.el5.centos.2
httpd-manual-2.2.3-22.el5.centos.2
  
  2.测试删除apache包
#rpm -e --test   httpd-devel-2.2.3-22.el5.centos.2 --nodeps
#rpm -e --test   httpd-2.2.3-22.el5.centos.2 --nodeps
#rpm -e --test   httpd-manual-2.2.3-22.el5.centos.2
  
  3.检查依赖关系
#rpm -q --whatrequires httpd-2.2.3-22.el5.centos.2
#rpm -q --whatrequires httpd-devel-2.2.3-22.el5.centos.2
  
  准备
1.停止httpd
# service httpd stop
Stopping httpd:
  
  2.删除apache httpd包(也可以不删除。安装新的到不同目录)
#rpm -e   httpd-devel-2.2.3-22.el5.centos.2 --nodeps
#rpm -e   httpd-2.2.3-22.el5.centos.2 --nodeps
warning: /etc/httpd/conf/httpd.conf saved as /etc/httpd/conf/httpd.conf.rpmsave
#rpm -e   httpd-manual-2.2.3-22.el5.centos.2
  
  安装
当前目录/usr/local/src,安装目录/usr/local
#tar zxvfhttpd-2.2.15.tar.gz
#cd httpd-2.2.15
#./configure --prefix=/usr/local/httpd-2.2.15 --enable-mods-shared=all --enable-so --enable-rewrite
#make
#make install
  
  修改/usr/local/httpd-2.2.15/conf/httpd.conf
  #
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80      (可以指定端口,如果原httpd不删,可以另指定一个,如8080)
.......
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/usr/local/httpd-2.2.15/htdocs"
。。。
#
# This should be changed to whatever you set DocumentRoot to.
#

。。。。
  
  修改使能自动启动
#cp /usr/local/httpd-2.2.15/bin/apachectl/etc/rc.d/init.d/apache2.1.15 (也可以命名为httpd)
#vi /etc/rc.d/init.d/apache2.1.15
#!/bin/sh
添加#chkconfig:35 90 15
添加#description:apache httpd-2.2.15
#chkconfig --add apache2.1.15
#chkconfig --list
  
  启动
#service apache2.1.15 start



页: [1]
查看完整版本: apache安装步骤(redhat)