【RHEL8】

!!!测试环境我们首关闭防火墙和selinux

[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld
[root@localhost ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
[root@localhost ~]# setenforce 0  

一、首先安装Apache安装环境

[root@localhost ~]# yum install -y make gcc gcc-c++ expat-devel

二、下载Apache扩展包

//安装Apache需要下载apr、apr-util、pcre这三个扩展包
wget https://mirror.bit.edu.cn/apache/apr/apr-1.6.5.tar.gz wget https://mirror.bit.edu.cn/apache/apr/apr-util-1.6.1.tar.gz wget https://netix.dl.sourceforge.net/project/pcre/pcre/8.40/pcre-8.40.tar.gz //下载Apache安装包
wget https://mirror.bit.edu.cn/apache/httpd/httpd-2.4.46.tar.gz 

三、解压,预编译,安装APR扩展包

[root@localhost ~]# tar -zxvf apr-1.6.5.tar.gz
[root@localhost ~]# cd apr-1.6.5/
[root@localhost apr-1.6.5]# ./configure --prefix=/usr/local/apr
...........
configure: creating ./config.status
config.status: creating Makefile
config.status: WARNING: 'Makefile.in' seems to ignore the --datarootdir setting
config.status: creating include/apr.h
config.status: creating build/apr_rules.mk
config.status: creating build/pkg/pkginfo
config.status: creating apr-1-config
config.status: creating apr.pc
config.status: creating test/Makefile
config.status: creating test/internal/Makefile
config.status: creating include/arch/unix/apr_private.h
config.status: executing libtool commands
rm: cannot remove 'libtoolT': No such file or directory
config.status: executing default commands
//预编译没有报错,说明预编译成功
[root@localhost apr-1.6.5]# make && make install
............
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
/usr/bin/install -c -m 644 apr.exp /usr/local/apr/lib/apr.exp
/usr/bin/install -c -m 644 apr.pc /usr/local/apr/lib/pkgconfig/apr-1.pc
for f in libtool shlibtool; do \
if test -f ${f}; then /usr/bin/install -c -m 755 ${f} /usr/local/apr/build-1; fi; \
done
/usr/bin/install -c -m 755 /root/apr-1.6.5/build/mkdir.sh /usr/local/apr/build-1
for f in make_exports.awk make_var_export.awk; do \
/usr/bin/install -c -m 644 /root/apr-1.6.5/build/${f} /usr/local/apr/build-1; \
done
/usr/bin/install -c -m 644 build/apr_rules.out /usr/local/apr/build-1/apr_rules.mk
/usr/bin/install -c -m 644 /root/apr-1.6.5/build/apr_common.m4 /usr/local/apr/build-1
/usr/bin/install -c -m 644 /root/apr-1.6.5/build/find_apr.m4 /usr/local/apr/build-1
/usr/bin/install -c -m 755 apr-config.out /usr/local/apr/bin/apr-1-config
//安装过程没有报错,说明安装成功,然后去/usr/local下面看有没有apr目录
[root@localhost apr-1.6.5]# ls /usr/local/
apr bin etc games include lib lib64 libexec sbin share src
[root@localhost apr-1.6.5]# ls /usr/local/apr/
bin build-1 include lib
//出现以上文件说明安装成功  

四、解压、预编译、安装apr-util扩展包

[root@localhost ~]# tar -zxvf apr-util-1.6.1.tar.gz
[root@localhost ~]# cd apr-util-1.6.1/
[root@localhost apr-util-1.6.1]# ./configure --prefix=/usr/local/apr-util -with-apr=/usr/local/apr
//在这说明一下,这里预编译必须指明apr文件路径,否则会报错
...........
configure: creating ./config.status
config.status: creating Makefile
config.status: creating export_vars.sh
config.status: creating build/pkg/pkginfo
config.status: creating apr-util.pc
config.status: creating apu-1-config
config.status: creating include/private/apu_select_dbm.h
config.status: creating include/apr_ldap.h
config.status: creating include/apu.h
config.status: creating include/apu_want.h
config.status: creating test/Makefile
config.status: creating include/private/apu_config.h
config.status: executing default commands
//预编译过程没有报错,说明安装成功
[root@localhost apr-util-1.6.1]# make && make install
............
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the '-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the 'LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the 'LD_RUN_PATH' environment variable
during linking
- use the '-Wl,-rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to '/etc/ld.so.conf' See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
/usr/bin/install -c -m 644 aprutil.exp /usr/local/apr-util/lib
/usr/bin/install -c -m 755 apu-config.out /usr/local/apr-util/bin/apu-1-config
//安装过程没有报错,说明安装成功
[root@localhost apr-util-1.6.1]# ls /usr/local/
apr apr-util bin etc games include lib lib64 libexec sbin share src
[root@localhost apr-util-1.6.1]# ls /usr/local/apr-util/
bin include lib
//出现上面所示的目录,说明安装成功  

五、解压、预编译、安装PCRE扩展包

[root@localhost ~]# tar -zxvf pcre-8.40.tar.gz
[root@localhost ~]# cd pcre-8.40/
[root@localhost pcre-8.40]# ./configure --prefix=/usr/local/pcre
...........
Internal link size .............. : 2
Nested parentheses limit ........ : 250
Match limit ..................... : 10000000
Match limit recursion ........... : MATCH_LIMIT
Build shared libs ............... : yes
Build static libs ............... : yes
Use JIT in pcregrep ............. : no
Buffer size for pcregrep ........ : 20480
Link pcregrep with libz ......... : no
Link pcregrep with libbz2 ....... : no
Link pcretest with libedit ...... : no
Link pcretest with libreadline .. : no
Valgrind support ................ : no
Code coverage ................... : no
//预编译过程没有报错,说明安装成功
[root@localhost pcre-8.40]# make && make install
...........
ln -sf pcre_pattern_to_host_byte_order.3 /usr/local/pcre/share/man/man3/pcre32_pattern_to_host_byte_order.3
ln -sf pcre_refcount.3 /usr/local/pcre/share/man/man3/pcre32_refcount.3
ln -sf pcre_study.3 /usr/local/pcre/share/man/man3/pcre32_study.3
ln -sf pcre_utf32_to_host_byte_order.3 /usr/local/pcre/share/man/man3/pcre32_utf32_to_host_byte_order.3
ln -sf pcre_version.3 /usr/local/pcre/share/man/man3/pcre32_version.3
make[3]: 离开目录“/root/pcre-8.40”
make[2]: 离开目录“/root/pcre-8.40”
make[1]: 离开目录“/root/pcre-8.40”
//安装成功没有报错,说明安装成功
[root@localhost pcre-8.40]# ls /usr/local/
apr apr-util bin etc games include lib lib64 libexec pcre sbin share src
[root@localhost pcre-8.40]# ls /usr/local/pcre/
bin include lib share
//出现上面所示的目录,说明安装成功  

六、解压、预编译、安装Apache服务

[root@localhost ~]# tar -zxvf httpd-2.4.46.tar.gz
[root@localhost ~]# cd httpd-2.4.46/
[root@localhost httpd-2.4.46]# ./configure --prefix=/usr/local/httpd \
> --with-apr=/usr/local/apr \
> --with-apr-util=/usr/local/apr-util \
> --with-pcre=/usr/local/pcre \
> --enable-so \ //动态模块加载方式
> --enable-rewrite //支持rewrite(地址重定向)
.............
config.status: creating build/rules.mk
config.status: creating build/pkg/pkginfo
config.status: creating build/config_vars.sh
config.status: creating include/ap_config_auto.h
config.status: executing default commands
configure: summary of build options: Server Version: 2.4.46
Install prefix: /usr/local/httpd
C compiler: gcc
CFLAGS: -g -O2 -pthread
CPPFLAGS: -DLINUX -D_REENTRANT -D_GNU_SOURCE
LDFLAGS:
LIBS:
C preprocessor: gcc -E
//预编译过程没有报错,说明预编译成功
[root@localhost httpd-2.4.46]# make && make install
...........
Installing CGIs
mkdir /usr/local/httpd/cgi-bin
Installing header files
mkdir /usr/local/httpd/include
Installing build system files
mkdir /usr/local/httpd/build
Installing man pages and online manual
mkdir /usr/local/httpd/man
mkdir /usr/local/httpd/man/man1
mkdir /usr/local/httpd/man/man8
mkdir /usr/local/httpd/manual
make[1]: 离开目录“/root/httpd-2.4.46”
//安装过程没有报错,说明安装成功
[root@localhost httpd-2.4.46]# ls /usr/local/
apr apr-util bin etc games httpd include lib lib64 libexec pcre sbin share src
[root@localhost httpd-2.4.46]# ls /usr/local/httpd/
bin build cgi-bin conf error htdocs icons include logs man manual modules
//出现什么所示目录,说明安装成功

七、给httpd启动脚本建立软链接,加入/usr/local/bin/里面(用户环境变量)

[root@localhost ~]# ln -s /usr/local/httpd/bin/apachectl /usr/local/bin/apachectl

八、修改httpd.conf的配置文件

[root@localhost ~]# cd /usr/local/httpd/conf/
[root@localhost conf]# ls
extra httpd.conf magic mime.types original
[root@localhost conf]# vim httpd.conf
...........
User apache //所列出的是需要修改的内容
Group apache
...........
ServerName 192.168.174.128:80 //将servername修改自己的IP加端口号

九、创建apache用户

[root@localhost ~]# groupadd -r apache
[root@localhost ~]# useradd -r -g apache apache
[root@localhost ~]# id apache
uid=991(apache) gid=987(apache) 组=987(apache) 

十、启动httpd服务

[root@localhost ~]# apachectl start
[root@localhost ~]# netstat -tunlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1083/sshd
tcp6 0 0 :::80 :::* LISTEN 59291/httpd
tcp6 0 0 :::22 :::* LISTEN 1083/sshd
udp 0 0 0.0.0.0:68 0.0.0.0:* 1588/dhclient

十一、测试Apache首页

安装成功!!!

源码安装Apache(httpd)的更多相关文章

  1. 烂泥:源码安装apache

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

  2. linux下源码安装apache服务

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

  3. Centos7源码安装Apache和PHP

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

  4. centos7源码安装Apache及Tomcat

    源码安装Apache (1) 一.通过 https://apr.apache.org/  下载 APR 和 APR-util 通过 http://httpd.apache.org/download.c ...

  5. 源码安装apache

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

  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. 源码安装Apache,报错:Cannot use an external APR with the bundled APR-util和httpd: Could not reliably determine the server's fully qualified domain name, using

    一.解决APR和APR-util错误: 1.1.安装APR: [root@ganglia httpd-2.2.23]# cd srclib/apr [root@ganglia apr]# ./conf ...

  9. 源码安装apache脚本

    #!/bin/bash#By:zhaocheng#Date:2019-01-18 [ -d /media/cdrom ] || mkdir /media/cdrom[ -d /media/cdrom/ ...

随机推荐

  1. 机器学习--PR曲线, ROC曲线

    在机器学习领域,如果把Accuracy作为衡量模型性能好坏的唯一指标,可能会使我们对模型性能产生误解,尤其是当我们模型输出值是一个概率值时,更不适宜只采取Accuracy作为衡量模型性泛化能的指标.这 ...

  2. Spring Security OAuth2 实现登录互踢

    背景说明 一个账号只能一处登录,类似的业务需求在现有后管类系统是非常常见的. 但在原有的 spring security oauth2 令牌方法流程(所谓的登录)无法满足类似的需求. 我们先来看 To ...

  3. 「HTML+CSS」--自定义加载动画【016】

    前言 Hello!小伙伴! 首先非常感谢您阅读海轰的文章,倘若文中有错误的地方,欢迎您指出- 哈哈 自我介绍一下 昵称:海轰 标签:程序猿一只|C++选手|学生 简介:因C语言结识编程,随后转入计算机 ...

  4. 算法、数据结构、与设计模式等在游戏开发中的运用 (一):单例设计(Singleton Design)

    算法.数据结构.与设计模式等在游戏开发中的运用 (一):单例设计(Singleton Design) 作者: Compasslg 李涵威 1. 什么是单例设计(Singleton Design) 在学 ...

  5. 支持多线程的Redis6.0来了

    支持多线程的 Redis 6.0 版本于 2020-05-02 终于发布了,为什么 Redis 忽然要支持多线程?如何开启多线程?开启后性能提升效果如何?线程数量该如何设置?开启多线程后会不会有线程安 ...

  6. PostMessage xss学习和挖掘

    PostMessage xss很有趣,在国外出现了很多次,国内src/众测从没遇到过,挖到过.可能境界还不够,有机会再去试试.好几年前记得心血来潮学过一次,都是半知半解,后来因为重要性不高,不了了之了 ...

  7. F - Lakes in Berland(BFS)

    The map of Berland is a rectangle of the size n × m, which consists of cells of size 1 × 1. Each cel ...

  8. SpringAOP_设置注入实现

    SpringAOP_设置注入实现 AOP_面向切面编程初步了解 让我们先想象一个场景,你正在编写一个项目,在开发过程中的多个模块都有某段重复的代码,于是你选择将其抽象成一个方法,然后在需要的地方调用这 ...

  9. php 操作 redis 常用命令

    原文地址: https://www.cnblogs.com/zhanghanwen16/p/9510481.html 1.redis连接与认证 //连接参数:ip.端口.连接超时时间,连接成功返回tr ...

  10. POJ2709 染料贪心

    题意:       要搭配出来n种颜料,每种颜料要用mi升,除了这n种颜色还有一个合成灰色的毫升数,灰色是由三种不同的颜色合成的,三种m m m 的不同颜色能合成m升灰色,然后问你满足要求至少要多少盒 ...