首页 > 其他分享 >在linu系统安装apache全过程(httpd、apr、apr-util、pcre)以及进行相应配置

在linu系统安装apache全过程(httpd、apr、apr-util、pcre)以及进行相应配置

时间:2022-11-22 16:48:54浏览次数:48  
标签:pcre httpd apr bes2 -- apache root

1.下载安装包,需要下面3个安装包
[root@bes2 apache]# ll
总用量 8520
-rw-r--r--. 1 root root 1020833 9月 18 17:47 apr-1.5.1.tar.gz
-rw-r--r--. 1 root root 874462 9月 18 17:48 apr-util-1.5.3.tar.gz
-rw-r--r--. 1 root root 6820719 9月 18 17:40 httpd-2.4.10.tar.gz

ps:下载可以去apache官网下载http://www.apache.org/,点击download进入下载页面,点击 http://mirror.bit.edu.cn/apache/,选择apr和httpd文件夹,下载相应的安装包

2.解压下载的安装包
[root@bes2 apache]# tar -zvxf httpd-2.4.10.tar.gz
[root@bes2 apache]# tar -zvxf apr-1.5.1.tar.gz
[root@bes2 apache]# tar -zvxf apr-util-1.5.3.tar.gz
[root@bes2 apache]# ll
总用量 8532
drwxr-xr-x. 27 1000 1000 4096 4月 16 07:37 apr-1.5.1
-rw-r--r--. 1 root root 1020833 9月 18 17:47 apr-1.5.1.tar.gz
drwxr-xr-x. 19 1000 1000 4096 11月 14 2013 apr-util-1.5.3
-rw-r--r--. 1 root root 874462 9月 18 17:48 apr-util-1.5.3.tar.gz
drwxr-xr-x. 11 test games 4096 7月 16 01:15 httpd-2.4.10
-rw-r--r--. 1 root root 6820719 9月 18 17:40 httpd-2.4.10.tar.gz

问题:可以看见上面解压出来的文件夹的属主和组别与压缩包文件不一致
原因:登录下载生成的文件属主就是那个用户,至于文件压缩包里面文件的属性是由打包时原文件状态决定的。
若希望解压出来的文件的属主和组别与压缩包一致,可以使用以下解压方式
[root@bes2 apache]# tar --no-same-owner -zvxf httpd-2.4.10.tar.gz
[root@bes2 apache]# tar --no-same-owner -zvxf apr-1.5.1.tar.gz
[root@bes2 apache]# tar --no-same-owner -zvxf apr-util-1.5.3.tar.gz
[root@bes2 apache]# ll
总用量 8532
drwxr-xr-x. 27 root root 4096 4月 16 07:37 apr-1.5.1
-rw-r--r--. 1 root root 1020833 9月 18 17:47 apr-1.5.1.tar.gz
drwxr-xr-x. 19 root root 4096 11月 14 2013 apr-util-1.5.3
-rw-r--r--. 1 root root 874462 9月 18 17:48 apr-util-1.5.3.tar.gz
drwxr-xr-x. 11 root root 4096 7月 16 01:15 httpd-2.4.10
-rw-r--r--. 1 root root 6820719 9月 18 17:40 httpd-2.4.10.tar.gz

3.安装apr
[root@bes2 apache]# cd apr-1.5.1
[root@bes2 apr-1.5.1]# ./configure --prefix=/usr/local/apr ——配置
报错:
config.status: executing libtool commands
rm: cannot remove `libtoolT': No such file or directory
config.status: executing default commands
解决方法:
[root@bes2 apr-1.5.1]# yum install libtool ——安装libtool
完成后,重新执行配置apr命令,接着又出现下面错误
config.status: executing libtool commands
rm: cannot remove `libtoolT': No such file or directory
config.status: executing default commands
config.status: include/apr.h is unchanged
config.status: include/arch/unix/apr_private.h is unchanged
解决方法:
直接打开/usr/local/src/apr-1.5.1/configure 把 $RM “$cfgfile” 那行删除掉
$RM “$cfgfile” 大约在 42302 行
然后再重新运行 ./configure --prefix=/usr/local/apr 就可以了
[root@bes2 apr-1.5.1]# make ——编译
[root@bes2 apr-1.5.1]# make install ——安装

4.安装apr-util
[root@bes2 apr-1.5.1]# cd ../apr-util-1.5.3
[root@bes2 apr-util-1.5.3]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr ——配置
[root@bes2 apr-util-1.5.3]# make ——编译
[root@bes2 apr-util-1.5.3]# make install ——安装

5.安装httpd
[root@bes2 apache]# cd httpd-2.4.10
[root@bes2 httpd-2.4.10]# ./configure --prefix=/usr/local/httpd --enable-module=so --with-apr-util=/usr/local/apr-util/ ——配置
报错:
checking for pcre-config... false
configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/
解决方法:安装pcre,安装完成后重新执行上述配置命令
[root@bes2 httpd-2.4.10]# yum install pcre
使用上述方法还是不行,下载压缩包进行安装
[root@bes2 apache]# wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.35.tar.gz
[root@bes1 pcre-8.35]# ./configure --prefix=/usr/local/pcre
报错:
configure: error: You need a C++ compiler for C++ support.

安装gcc c++
[root@bes1 ~]# yum install -y gcc gcc-c++

成功后重新安装pcre,执行上面的配置命令,完成后继续往下
[root@bes1 pcre-8.35]#make ——编译
[root@bes1 pcre-8.35]#make install ——安装

上述完成后,继续安装httpd
[root@bes2 httpd-2.4.10]# ./configure --prefix=/usr/local/httpd --enable-module=so --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre ——配置
[root@bes2 httpd-2.4.10]# make
[root@bes2 httpd-2.4.10]# make install

6.配置apache
[root@localhost httpd-2.2.6]#cd /usr/local/httpd/conf //进入httpd配置文件的目录
[root@localhost conf]#cp -a httpd.conf httpd.conf.bak //备份apache配置文件
[root@localhost conf]#cd /usl/local/httpd/bin
ps:如果没有httpd服务,则不需要执行下面这段代码
[root@localhost conf]#chkconfig --list httpd //查看httpd服务是否已存在
[root@localhost conf]#chkconfig httpd off //关闭系统自带了httpd的服务,如果存在httpd服务
[root@localhost conf]#service httpd status //查看自带httpd服务状态
[root@localhost conf]#/usr/local/httpd/bin/apachectl -k start //linux启动apache命令
[root@localhost conf]#netstat -an | grep :80 //查看linux80端口是否开启
[root@localhost conf]#ps -aux | grep httpd //linux下查看apache进程
[root@localhost conf]#cd ../..
[root@localhost bin]#cp apachectl /etc/rc.d/init.d/httpd //拷贝apache启动脚本
[root@localhost bin]#vi /etc/rc.d/init.d/httpd // 这里是编辑apache启动脚本
在开头的#!/bin/sh 下面加上
#chkconfig: 2345 85 15
[root@localhost bin]#chkconfig --add apache //添加apache服务
[root@localhost bin]#chkconfig --list apache //列出apache服务
[root@localhost bin]#service apache stop //停止apache服务
[root@localhost bin]#netstat -an | grep :80 //查看linux的80端口是否关闭
[root@localhost bin]#ps -aux | grep httpd //查看是否存在httpd服务,若果之前自带httpd服务启动的话会导致新添加的apache服务启动失败
[root@localhost local]#service apache start //启动apache服务

问题:在web页面输入http://ip,遇到问题,页面无法打开
原因:防火墙未添加端口
解决方法:在防火墙添加端口
[root@bes1 conf]# cd /etc/sysconfig/
[root@bes1 sysconfig]# cp -r iptables iptables.bak
[root@bes1 sysconfig]# vim iptables
添加下面这一行
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
[root@bes1 sysconfig]# service iptables restart
iptables:清除防火墙规则: [确定]
iptables:将链设置为政策 ACCEPT:filter [确定]
iptables:正在卸载模块: [确定]
iptables:应用防火墙规则: [确定]
[root@bes1 sysconfig]# service httpd restart

----完成上述操作后,在前台页面输入访问地址 http://安装apache的ip,可正常访问

标签:pcre,httpd,apr,bes2,--,apache,root
From: https://www.cnblogs.com/exmyth/p/16915561.html

相关文章

  • Haproxy搭建web集群
    一、常见的web集群调度器目前常见的web集群调度器分为软件和硬件软件通常使用开源的LVS、Haproxy、Nginx,LVS性能最好,但搭建复杂。Nginx并发量,性能低于Haproxy硬件一般......
  • Haproxy搭建web群集 _
    一.常见的web集群调度器1、目前常见的web集群调度器分为软件和硬件2、软件通常使用开源的LVS、Haproxy、Nginx​LVS性能最好,但搭建复杂。Nginx并发量,性能低于Haproxy......
  • Haproxy搭建web群集
    一.常见的web集群调度器1、目前常见的web集群调度器分为软件和硬件2、软件通常使用开源的LVS、Haproxy、Nginx​LVS性能最好,但搭建复杂。Nginx并发量,性能低于Haproxy......
  • Haproxy搭建web集群
    一.常见的web集群调度器1、目前常见的web集群调度器分为软件和硬件2、软件通常使用开源的LVS、Haproxy、Nginx​LVS性能最好,但搭建复杂。Nginx并发量,性能低于Haproxy......
  • Linux 搭建Apache(httpd)服务
    简介:ApacheHTTPServer是开源软件项目,基于标准的HTTP网络协议提供的网页浏览服务,http是Apache服务器的主程序,它是一个独立的后台进程。1.安装A.安装httpd服务:yun......
  • 读Bilgin Ibryam 新作 《Dapr 是一种10倍数 平台》
    BilginIbryam最近加入了开发者软件初创公司DiagridInc,他是ApacheSoftwareFoundation的committer和成员。他也是一个开源的布道师,并且是书籍Kubernetes设计模式和......
  • Hadoop序列化之MapReduce案例
    Hadoop序列化序列化概述序列化就是把内存中的对象、转换成字节系列(或者其他数据传输协议)以便于存储到磁盘(持久化)和网络传输。反序列化就是将收到字节序列(或其他数据传输......
  • 配置 haproxy 负载均衡群集
    配置haproxy负载均衡群集......
  • R语言Apriori关联规则、kmeans聚类、决策树挖掘研究京东商城网络购物用户行为数据可视
    全文链接:http://tecdat.cn/?p=30360原文出处:拓端数据部落公众号随着网络的迅速发展,依托于网络的购物作为一种新型的消费方式,在全国乃至全球范围内飞速发展。电子商务成为......
  • MapReduce框架原理
    1MapReduce工作流程1)流程示意图2)流程详解上面的流程是整个mapreduce最全工作流程,但是shuffle过程只是从第7步开始到第16步结束,具体shuffle过程详解,如下:1)maptask收集我们的m......