httpd源码安装

#httpd源码安装

[root@localhost ~]# wget https://downloads.apache.org/apr/apr-1.6.5.tar.bz2 
--2022-07-20 19:27:44--  https://downloads.apache.org/apr/apr-1.6.5.tar.bz2
Resolving downloads.apache.org (downloads.apache.org)... 135.181.214.104, 88.99.95.219, 2a01:4f9:3a:2c57::2, ...
Connecting to downloads.apache.org (downloads.apache.org)|135.181.214.104|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 855393 (835K) [application/x-bzip2]
Saving to: 'apr-1.6.5.tar.bz2'

apr-1.6.5.tar.bz2           100%[===========================================>] 835.34K   531KB/s    in 1.6s    

2022-07-20 19:27:47 (531 KB/s) - 'apr-1.6.5.tar.bz2' saved [855393/855393]

[root@localhost ~]# wget https://downloads.apache.org/httpd/httpd-2.4.54.tar.bz2 
--2022-07-20 19:27:57--  https://downloads.apache.org/httpd/httpd-2.4.54.tar.bz2
Resolving downloads.apache.org (downloads.apache.org)... 88.99.95.219, 135.181.214.104, 2a01:4f8:10a:201a::2, ...
Connecting to downloads.apache.org (downloads.apache.org)|88.99.95.219|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 7434530 (7.1M) [application/x-bzip2]
Saving to: 'httpd-2.4.54.tar.bz2'

httpd-2.4.54.tar.bz2        100%[===========================================>]   7.09M  2.50MB/s    in 2.8s    

2022-07-20 19:28:01 (2.50 MB/s) - 'httpd-2.4.54.tar.bz2' saved [7434530/7434530]

[root@localhost ~]# wget https://downloads.apache.org/apr/apr-util-1.6.1.tar.bz2
--2022-07-20 19:28:11--  https://downloads.apache.org/apr/apr-util-1.6.1.tar.bz2
Resolving downloads.apache.org (downloads.apache.org)... 135.181.214.104, 88.99.95.219, 2a01:4f9:3a:2c57::2, ...
Connecting to downloads.apache.org (downloads.apache.org)|135.181.214.104|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 428595 (419K) [application/x-bzip2]
Saving to: 'apr-util-1.6.1.tar.bz2'

apr-util-1.6.1.tar.bz2      100%[===========================================>] 418.55K  5.34KB/s    in 84s     

2022-07-20 19:29:40 (4.97 KB/s) - 'apr-util-1.6.1.tar.bz2' saved [428595/428595]

解压,先解压依赖包在解压主包

[root@localhost usr]# tar xf apr-1.6.5.tar.bz2 
[root@localhost usr]# cd apr-1.6.5/
[root@localhost apr-1.6.5]# vim configure

将此行注释或删除
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-87tobWy7-1659683734722)(./1657787768282.png)]
解压apr-util包

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
config.status: executing default commands

[root@localhost apr-1.6.5]# ./configure --prefix=/usr/local/apr 

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 /usr/apr-1.6.5/build/apr_common.m4 /usr/local/apr/build-1
/usr/bin/install -c -m 644 /usr/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

[root@localhost apr-1.6.5]# make && make install 

解压apr-util包

[root@localhost usr]# tar xf apr-util-1.6.1.tar.bz2 
[root@localhost usr]# cd apr-util-1.6.1/
[root@localhost apr-util-1.6.1]# 
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]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr 

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]# make && make install 

解压主包

[root@localhost usr]# tar xf httpd-2.4.54.tar.bz2 
[root@localhost usr]# cd httpd-2.4.54/
[root@localhost httpd-2.4.54]# 

  Server Version: 2.4.54
    Install prefix: /usr/local/apache
    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.54]# ./configure --prefix=/usr/local/apache --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util

mkdir /usr/local/apache/cgi-bin
Installing header files
mkdir /usr/local/apache/include
Installing build system files
mkdir /usr/local/apache/build
Installing man pages and online manual
mkdir /usr/local/apache/man
mkdir /usr/local/apache/man/man1
mkdir /usr/local/apache/man/man8
mkdir /usr/local/apache/manual
make[1]: Leaving directory '/usr/httpd-2.4.54'

[root@localhost httpd-2.4.54]# make && make install

启动apache服务

[root@localhost httpd-2.4.54]# /usr/local/apache/bin/apachectl 
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
[root@localhost httpd-2.4.54]# 

浏览器访问
在这里插入图片描述
配置环境变量

[root@localhost httpd-2.4.54]# /usr/local/apache/bin/apachectl stop 
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
[root@localhost httpd-2.4.54]# vim /etc/profile.d/apache.sh 
export PATH=$PATH:/usr/local/apache/bin/ 

[root@localhost httpd-2.4.54]# source /etc/profile.d/apache.sh 
[root@localhost httpd-2.4.54]# apachectl start 
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
[root@localhost httpd-2.4.54]# ss -antl
State        Recv-Q       Send-Q             Local Address:Port             Peer Address:Port      Process      
LISTEN       0            128                      0.0.0.0:111                   0.0.0.0:*                      
LISTEN       0            32                 192.168.122.1:53                    0.0.0.0:*                      
LISTEN       0            128                      0.0.0.0:22                    0.0.0.0:*                      
LISTEN       0            5                      127.0.0.1:631                   0.0.0.0:*                      
LISTEN       0            128                         [::]:111                      [::]:*                      
LISTEN       0            128                            *:80                          *:*                      
LISTEN       0            128                         [::]:22                       [::]:*                      
LISTEN       0            5                          [::1]:631                      [::]:*                      
[root@localhost httpd-2.4.54]# 

在这里插入图片描述

[root@localhost httpd-2.4.54]# ln -s /usr/local/apache /usr/local/hello 
[root@localhost httpd-2.4.54]# ll /usr/local/ 
total 0
drwxr-xr-x. 14 root root 164 Jul 14 16:51 apache
drwxr-xr-x.  6 root root  58 Jul 14 16:39 apr
drwxr-xr-x.  5 root root  43 Jul 14 16:45 apr-util
drwxr-xr-x.  2 root root   6 Jun 22  2021 bin
drwxr-xr-x.  2 root root   6 Jun 22  2021 etc
drwxr-xr-x.  2 root root   6 Jun 22  2021 games
lrwxrwxrwx.  1 root root  17 Jul 14 16:59 hello -> /usr/local/apache
drwxr-xr-x.  2 root root   6 Jun 22  2021 include
drwxr-xr-x.  2 root root   6 Jun 22  2021 lib
drwxr-xr-x.  3 root root  17 Jun 30 14:35 lib64
drwxr-xr-x.  2 root root   6 Jun 22  2021 libexec
drwxr-xr-x. 11 root root 151 Jul 14 15:52 nginx
drwxr-xr-x.  2 root root   6 Jun 22  2021 sbin
drwxr-xr-x.  5 root root  49 Jun 30 14:35 share
drwxr-xr-x.  2 root root   6 Jun 22  2021 src
[root@localhost httpd-2.4.54]# 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值