源码安装Apache

(1)

一.通过 https://apr.apache.org/  下载 APR 和 APR-util

通过 http://httpd.apache.org/download.cgi   下载 httpd

通过 https://ftp.pcre.org/pub/pcre/   下载  pcre

二、配置安装环境

yum -y install gcc gcc-c++ make expat-devel

三、解压与编译安装

mkdir /data

(1)编译安装 APR

tar xf apr-1.7.0.tar.gz -C /data

cd /data

mv apr-1.7.0/ apr

cd apr/

./configure --prefix=/data/apr && make && make install

(2)编译安装 APR-util

tar xf apr-util-1.6.1.tar.gz -C /data

cd /data

mv apr-util-1.6.1/ apr-util

cd apr-util/

./configure --prefix=/data/apr-util --with-apr=/data/apr && make && make install

(3)编译安装 pcre

tar xf pcre-8.43.tar.gz -C /data

cd /data

mv pcre-8.43/ pcre

cd pcre/

./configure --prefix=/data/pcre && make && make install

(4)编译安装 httpd

tar xf httpd-2.4.41.tar.gz -C /data

cd /data

mv httpd-2.4.41/ apache

cd apache/

./configure --prefix=/data/apache --with-apr=/data/apr --with-apr-util=/data/apr-util && make && make install

四、启动与关闭

/data/apache/bin/apachectl start //启动

/data/apache/bin/apachectl  stop //关闭

开放80端口

firewall-cmd --permanent --and-port=80/tcp

firewall-cmd -reload

配置开机自启

(1)将 apachectl 命令拷贝到 /etc/init.d 目录下,改名为httpd

cp /data/apache/bin/apachectl /etc/init.d/httpd

(2)编辑 /etc/init.d/httpd 文件,在第一行 #!/bin/bash 的后面添加如下两行

chkconfig: 2345 70 40

说明:2345 表示脚本运行的级别,即在2、3、4、5这4种模式下都可以运行,70 表示脚本启动的顺序号,40 表示系统关闭时,脚本的停止顺序号

description:apache

(3)将 Apache 服务加入到系统服务

chkconfig --add httpd

chkconfig --list httpd

(4)通过使用 systemctl 命令控制 Apache 的启动和停止

启动 Apache 服务

systemctl start httpd.service

查看 Apache 服务运行状态

systemctl status httpd.service

关闭 Apache 服务

systemctl stop httpd.service

五、安装中遇到的问题以及解决办法

错误:configure:error:no acceptable C compiler found in $PATH

解决:需要安装 gcc

错误:rm:cannot remove ‘libtoolT’:No such file or directory

解决:编辑 /data/apr/configure , 找到 $RM '$cfgfile' 进行注释

错误:configure:error:APR not found. Please read the documentation.

解决:需要安装 APR 和 APR-util

错误:xml/apr_xml.c:35:19: 致命错误:expat.h:没有那个文件或目录

解决:需要安装 expat-devel 包

错误:configure:error:pcre-config for libpcre not found. PCRE is required and availab le from

解决:需要安装 pcre

错误:如果报多个 .so:undefined reference to 'XXX'

解决:有可能是下载的 APR-util  包 有问题。换一个下载就好了。

 (2)

[root@localhost ~]# yum -y install gcc    //安装gcc

[root@localhost ~]# yum -y install make   //安装make

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

[root@localhost ~]# yum -y install lynx          //安装lynx

@localhost ~]# tar -xf httpd-2.2.17.tar.gz -C /usr/src    //解包

[root@localhost ~]# cd /usr/src/httpd-2.2.17/      //进入httpd-2.2.17文件目录

[root@localhost httpd-2.2.17]# config --prefix =/usr/local/apache     //安装目录

[root@localhost httpd-2.2.17]# make        //执行make命令

[root@localhost httpd-2.2.17]# make install   //执行make install命令

root@localhost httpd-2.2.17]# cd /usr/local/apache/conf       //切换目录

[root@localhost conf]# cp httpd.conf httpd.conf.bak

[root@localhost conf]# cd /usr/src/httpd-2.2.17/

[root@localhost conf]# vim httpd.conf

ServerName www.example.com:80

[root@localhost ~]# /usr/local/apache/bin/apachectl start      //启动Apache

[root[root@localhost ~]# lynx 127.0.0.1        //运行

源码安装Tomcat

(1)查看是否安装jdk

(2)卸载jdk的方式

方法一:which java

rm -rf /usr/bin/java

方法二:rpm -qa | grep -i openjdk

rpm -e java-1.7.0-openjdk

rpm -e java-1.7.0-openjdk-headless

rpm -e java-1.7.0-openjdk --nodeps

rpm -e java-1.7.0-openjdk-headless

rpm -qa | grep -i openjdk

(3)jdk安装

软件包jdk-8u191-linux-x64.tar.gz

解压当前目录下

用mv 移动到/usr/local/取名

定义环境变量 vim /etc/profile

设置java 根目录

在PATH 环境变量中添加Java 根目录的bin 子目录

用 source执行生效

安装tomcat

apache-tomcat-8.5.40.tar.gz

解压软件包当地

用ls 查看

解压后生成文件夹apache-tomcat-8.5.40

将文件夹移动到/usr/local/下,并改名为tomcat8

启动tomcat

查看8080端口

开启nginx 服务

用谷歌查看本地的ip 地址:8080

centos7源码安装Apache及Tomcat的更多相关文章

  1. Centos7源码安装Apache和PHP

    源码安装Apache 安装需要的依赖 yum -y install gcc autoconf automake make pcre pcre-devel openssl openssl-devel​# ...

  2. 烂泥:源码安装apache

    本文由秀依林枫提供友情赞助,首发于烂泥行天下. 最近要开始学习nagios监控方面的知识了,但是nagios与apache结合的比较紧密,所以本篇文章就先把apache的源码安装学习下. 我们现在分以 ...

  3. 源码安装apache

    目标:源码安装apache 依赖包:apr.apr-util和pcre.其中pcre正则库要先安装,apr和apr-util(已解压)可以复制到apache下的资源库srclib下. 安装pcre: ...

  4. linux下源码安装apache服务

    1.搭建静态网站是,我们只需要搭建apache服务即可满足要求. 例如:如果我再客户端游览器输入地址,他会找到192.168.1.100这个服务器,然后根据端口会找到apache服务器.apache他 ...

  5. centos7源码安装Python3的前提条件

    centos7源码安装Python3的前提条件: # yum -y install openssl-devel bzip2-devel expat-devel gdbm-devel readline- ...

  6. Linux 源码安装apache 与常见错误解决

    文档原位置 一.编译安装apache 1.解决依赖关系 httpd-2.4.4需要较新版本的apr和apr-util,因此需要事先对其进行升级. 升级方式有两种,一种是通过源代码编译安装,一种是直接升 ...

  7. 源码安装Apache,报错:Cannot use an external APR with the bundled APR-util

    一般在第一次源码安装是没有问题的,在版本变化情况下在次源码安装可能会遇到此问题: apache2.0.x与apache2.2.x在apr有很大区别,前者为依赖公用apr,后者依赖于自身的apr.一般前 ...

  8. centos7源码安装mysql5.7.19

    centos7源码包安装mysql5.7 5.7.20安装方法和5.7.19的一样. 1.安装前准备 清空环境.安装相应的软件包 1>关闭防火墙和SELinux 2>配置yum源(阿里云, ...

  9. Centos7源码安装mysql及读写分离,互为主从

       Linux服务器 -源码安装mysql 及读写分离,互为主从   一.环境介绍: Linux版本: CentOS 7 64位 mysq版本: mysql-5.6.26 这是我安装时所使用的版本, ...

随机推荐

  1. 从JDK源码学习Hashmap

    这篇文章记录一下hashmap的学习过程,文章并没有涉及hashmap整个源码,只学习一些重要部分,如有表述错误还请在评论区指出~ 1.基本概念 Hashmap采用key算hash映射到具体的valu ...

  2. 写一个TODO App学习Flutter本地存储工具Moor

    写一个TODO App学习Flutter本地存储工具Moor Flutter的数据库存储, 官方文档: https://flutter.dev/docs/cookbook/persistence/sq ...

  3. MTK Android Driver :Camera

    MTK Android Driver :camera 1.相关代码位置:mediatek\config\XXXX(红色字为具体的项目名) 文件:ProjectConfig.mk CUSTOM_KERN ...

  4. asap异步执行实现原理

    目录 为什么分析asap asap概述 asap源码解析-Node版 参考 1.为什么分析asap 在之前的文章 async和await是如何实现异步编程? 中的浅谈Promise如何实现异步执行小节 ...

  5. group_concat有长度限制

    group_concat有长度限制     group_concat 详细用法请点此链接.   group_concat有长度限制!长度陷阱用了group_concat后,select里如果使用了li ...

  6. Springboot启动流程简单分析

    springboot启动的类为SpringApplication,执行构造函数初始化属性值后进入run方法: 然后返回ConfigurableApplicationContext(spring应用). ...

  7. 动手学Transformer

    动手实现Transformer,所有代码基于tensorflow2.0,配合illustrated-transformer更香. 模型架构 Encoder+Decoder Encoder Decode ...

  8. Python 编程环境搭建(Windows 系统中)

    由于大家普遍使用 Windows 系统,所以本文只介绍 Windows 系统中 Python 环境的安装. 在 Windows 中安装 Python 与安装普通软件没什么差别,下载所需版本的安装包后, ...

  9. 2020不平凡的90天,Python分析三个月微博热搜数据带你回顾

    前言 文的文字及图片来源于网络,仅供学习.交流使用,不具有任何商业用途,版权归原作者所有,如有问题请及时联系我们以作处理. 作者:刘早起早起 PS:如有需要Python学习资料的小伙伴可以加点击下方链 ...

  10. codeforces 122C perfect team

    You may have already known that a standard ICPC team consists of exactly three members. The perfect ...