Centos源码安装Apache

  • 1、检查环境(主要是gcc环境)
  • 2、下载源码 apache源码、apr源码、apr-util源码、pcre源码
  • 3、安装依赖环境

              1:安装 apr ,安装步骤基本一直,解压,进入解压后的文件夹,修改配置,指定安装位置 ./configure --prefix=/usr/local/apr,,然后执行 编译 && 安装命令
              2:安装 apr-util 方式同apr一样,不同之处在于安装的位置改为apr-util并指定apr的位置 ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
              3:安装pcre 安装方式同apr。 修改配置 ./configure --prefix=/usr/local/pcre

  • 4、修改配置

           ./configure --prefix=/usr/local/apache2 \
            --with-apr=/usr/local/apr \
            --with-apr-util=/usr/local/apr-util \
            --with-pcre=/usr/local/pcre \
            --enable-cgi #因为cgi需要用到这个功能,所以需要在配置文件中配置

  • 5、编译 make
  • 6、安装 make install
  • 7、讲apache服务注册为系统服务,用于apache服务自启动

           1:cp /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/httpd(从安装目录下,讲apache的启动命令所在脚本复制到etc目录下)
           2:修改http脚本
           在文件头部加入如下内容:
           # chkconfig: 2345 90 90
           # description:http server
           3:执行命令
           chkconfig --add httpd           
           chkconfig --level 345 httpd on

  • 8、启动Apache。

           AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 10.172.223.116. Set the 'ServerName' directive globally to suppress this message
           原因是配置文件中的ServerName选项没有设置,修改安装$apachehome/conf/http.conf 文件,找到ServerName的配置项,去掉注释

posted @ 2014-08-20 15:38  yzl8615  阅读(202)  评论(0)    收藏  举报