在linu系统安装apache全过程(httpd、apr、apr-util、pcre)以及进行相应配置
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,可正常访问
在linu系统安装apache全过程(httpd、apr、apr-util、pcre)以及进行相应配置的更多相关文章
- Apache安装编译遇到APR的问题
http://mirrors.tuna.tsinghua.edu.cn/apache//httpd/httpd-2.4.27.tar.bz2Apache下载链接 在解压Apache源码包进入目录运行 ...
- apache安装错误error: APR not found解决办法
linux安装时安装种类不同,一些组件包可能不会被安装,导致linux下安装软件的时候缺这个缺那个,今天为大家介绍linux安装apache时报apr找不到的解决办法 方法/步骤 下载依赖包 wg ...
- Tomcat 8.5 基于 Apache Portable Runtime(APR)库性能优化
Tomcat可以使用Apache Portable Runtime来提供卓越的性能及可扩展性,更好地与本地服务器技术的集成.Apache Portable Runtime是一个高度可移植的库,位于Ap ...
- Linux系统安装Apache 2.4.6
Apache简介 Apache HTTP Server(简称Apache)是Apache软件基金会的一个开放源码的网页服务器,可以在大多数计算机操作系统中运行,由于其多平台和安全性被广 ...
- Apache的httpd命令详解
Apache的httpd命令详解 来源:全栈开发者 发布时间:2012-01-03 阅读次数:10965 4 httpd.exe为Apache HTTP服务器程序.直接执行程序可启动服务器的服务. ...
- Ubuntu14.04下编译安装或apt-get方式安装搭建Apache或Httpd服务(图文详解)
不多说,直接上干货! 写在前面的话 对于 在Ubuntu系统上,编译安装Apache它默认路径是在/usr/local/apache2/htdocs 或者编译安装httpd它默认路径是在/usr/lo ...
- Linux系统安装Apache
一,Apache和tomcat的区别与联系 apache是web服务器,web服务器专门处理http请求: tomcat是运行在apache上的应用服务器: apache是普通服务器,本身只支持htm ...
- Apache 的 httpd.conf 详解
ServerRoot “/usr/local“ ServerRoot用于指定守护进程httpd的运行目录,httpd在启动之后将自动将进程的当前目录改变为这个目录,因此如果设置文件中指定的文件或目录是 ...
- Apache配置文件httpd.conf内容翻译
本文已经废弃,现在apache2不依靠httpd.conf来配置. Ubuntu下默认的配置文件是/etc/apache2/sites-available/default 可以修改上面文件来修改a ...
- 安装Apache(httpd服务)
安装Apache(httpd服务) ① 移动所有压缩包到root文件夹下(root的家) ② 解压httpd压缩包(.tar.gz) 使用tar指令解压.tar.gz压缩包 tar 指令 -zxf : ...
随机推荐
- Failed to connect to github.com port 443: Connection refused问题解决
解决办法: 1.找到github的ip地址:查找链接 2.找到本地的hosts文件.我的hosts文件路劲为:C:\Windows\System32\drivers\etc 3.在hosts文件最后添 ...
- 活动预告 | 中国数据库联盟(ACDU)中国行第四站定档西安,邀您探讨数据库前沿技术
作为墨天轮社区与中国数据库联盟的品牌活动之一,[ACDU 中国行]已走过深圳.杭州.成都三大城市,在线下汇集数据库领域的行业知名人士,共同探讨数据库前沿技术及其应用,促进行业发展和创新,同时也为开发者 ...
- 动态去读 dll 文件
// 反射动态读取 dll // Assembly assembly = Assembly.LoadFile(); 路径 // Assembly assembly = Assembly.LoadFro ...
- Litmus 实践:让群魔在混沌中乱舞,看 K8s 能撑到何时
对于云服务而言,如果系统出现异常,将会带来很大的损失.为了最大程度地降低损失,我们只能不断探寻系统何时会出现异常,甚至缩小到某些特定参数变化是否会造成系统异常.然而随着云原生的发展,不断推进着微服务的 ...
- vue中绘制echarts折线图
1.安装echartscnpm install echarts --save 2.vue代码 <template> <div> //下面的div给表一个容器 <div i ...
- 关于 IntelliJ IDEA 2024 安装使用 (附加激活码、补丁,亲测有效)
第一步:下载 IDEA 安装包 访问 IDEA 官网,下载 IDEA 2024.1.4 版本的安装包,下载链接如下 : idea官方链接 也可以在这里点击下载idea https://pan.quar ...
- 【2024.08.15】NOIP2024暑假集训模拟赛(13)
[2024.08.15]NOIP2024暑假集训模拟赛(13) T1 先找能构成回文的最长前缀和后缀(长度相同的),然后在任意一边的基础上扩展,看能否接一个回文串. #include<bits/ ...
- php 读取 csv 转数组列表
我们有个文档需要修改,但是文档列太多,以及数量太大,以至于眼睛看起来很吃力,于是我决定做个简单的转化用脚本读取我想要验证的列的内容是否正确. 于是就产生了一个这样将csv快速的转为数组列表的功能函数 ...
- 牛客小白月赛105 (Python题解)
牛客小白月赛105 (Python题解) 比赛链接:点击传送 A-lz的吃饭问题 代码: a, b = map(int,input().split()) c, d = map(int,input(). ...
- Stratum挖矿协议&XMR挖矿流量分析
目录 前言 区块链和挖矿相关概念 挖矿木马 挖矿协议Stratum Stratum工作过程 XMR挖矿流量分析 环境搭建 流量分析 总结 前言 之前参与了一个关于"挖矿行为检测"的 ...