天天看点

httpd的升级httpd的升级

httpd的升级

//先安装旧版本 我这里为2.4.37版本
[[email protected] ~]# apachectl -v
Server version: Apache/2.4.37 (Unix)
Server built:   Nov 11 2019 09:07:35
//下载新版本
[[email protected] ~]# wget https://mirrors.tuna.tsinghua.edu.cn/apache/httpd/httpd-2.4.41.tar.bz2
--2019-11-11 09:17:13--  https://mirrors.tuna.tsinghua.edu.cn/apache/httpd/httpd-2.4.41.tar.bz2
正在解析主机 mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)... 101.6.8.193, 2402:f000:1:408:8100::1
正在连接 mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)|101.6.8.193|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:7072373 (6.7M) [application/octet-stream]
正在保存至: “httpd-2.4.41.tar.bz2”

100%[=================================>] 7,072,373   64.4KB/s 用时 68s    

2019-11-11 09:18:22 (101 KB/s) - 已保存 “httpd-2.4.41.tar.bz2” [7072373/7072373])

[[email protected] ~]# ls
httpd-2.4.41.tar.bz2
//解压新版本
[[email protected] ~]# tar xf httpd-2.4.41.tar.bz2 
[[email protected] ~]# ls
httpd-2.4.41  httpd-2.4.41.tar.bz2
//备份旧版本的主程序和配置文件
[[email protected] ~]# cd /usr/local/apache/
[[email protected] apache]# cp -r bin/  /tmp
[[email protected] apache]# ls /tmp
bin
systemd-private-55e25075dbcd4fdd898a15227b0deba8-chronyd.service-GEUtay
systemd-private-55e25075dbcd4fdd898a15227b0deba8-vgauthd.service-Q3WsQv
systemd-private-55e25075dbcd4fdd898a15227b0deba8-vmtoolsd.service-wTlsDt
[[email protected] apache]# ls /tmp/bin/
ab         checkgid   envvars-std   htdbm     httpd       rotatelogs
apachectl  dbmmanage  fcgistarter   htdigest  httxt2dbm
apxs       envvars    htcacheclean  htpasswd  logresolve
[[email protected] apache]# ls bin/
ab         checkgid   envvars-std   htdbm     httpd       rotatelogs
apachectl  dbmmanage  fcgistarter   htdigest  httxt2dbm
apxs       envvars    htcacheclean  htpasswd  logresolve
[[email protected] ~]# cd /etc/
[[email protected] etc]# ls httpd24/
extra  httpd.conf  magic  mime.types  original
[[email protected] etc]# cp -r httpd24/   /tmp
[[email protected] etc]# ls /tmp/httpd24/
extra  httpd.conf  magic  mime.types  original
// 编译新版本(不要执行安装)编译时使用的命令在httpd.nice中
[[email protected] httpd-2.4.41]# ./configure --prefix=/opt/apache \
> --sysconfdir=/etc/httpd24 \
> --enable-so \
> --enable-ssl \
> --enable-cgi \
> --enable-rewrite \
> --with-zlib \
> --with-pcre \
> --with-apr=/usr/local/apr \
> --with-apr-util=/usr/local/apr-util/ \
> --enable-modules=most \
> --enable-mpms-shared=all \
> --with-mpm=prefork
[[email protected] httpd-2.4.41]# make
// 将编译目录中的httpd复制到旧版本目录中
[[email protected] httpd-2.4.41]# ls
ABOUT_APACHE     config.log     InstallBin.dsp  NWGNUmakefile
acinclude.m4     config.nice    LAYOUT          os
Apache-apr2.dsw  config.status  libhttpd.dep    README
Apache.dsw       configure      libhttpd.dsp    README.cmake
apache_probes.d  configure.in   libhttpd.mak    README.platforms
ap.d             docs           LICENSE         ROADMAP
build            emacs-style    Makefile        server
BuildAll.dsp     httpd          Makefile.in     srclib
BuildBin.dsp     httpd.dep      Makefile.win    support
buildconf        httpd.dsp      modules         test
buildmark.o      httpd.mak      modules.c       VERSIONING
CHANGES          httpd.spec     modules.lo
CMakeLists.txt   include        modules.o
config.layout    INSTALL        NOTICE
[[email protected] httpd-2.4.41]# cp httpd /usr/local/apache/bin/
cp:是否覆盖"/usr/local/apache/bin/httpd"? y
// 检查新版本
[[email protected] httpd-2.4.41]# apachectl -v
Server version: Apache/2.4.41 (Unix)
Server built:   Nov 11 2019 09:28:10
```: