Apache-httpd版本太低會導致出現(xiàn)很多漏洞,本次安裝的版本為最新的Apache-2.4.57版本,操作系統(tǒng)為CentOS Linux release 7.9.2009 (Core)。首先在服務器上執(zhí)行命令查看httpd的版本,httpd -v
一、部署安裝
1、下載
http://dlcdn.apache.org//apr/apr-util-1.6.3.tar.gz
http://dlcdn.apache.org//apr/apr-1.7.4.tar.gz
http://jaist.dl.sourceforge.net/project/pcre/pcre/8.37/pcre-8.37.tar.gz
http://mirrors.tuna.tsinghua.edu.cn/apache/httpd/httpd-2.4.57.tar.gz
2、創(chuàng)建安裝目錄
mkdir /usr/local/apr
mkdir /usr/local/apr-util
mkdir /usr/local/pcre
mkdir /usr/local/httpd
3、編譯安裝apr
cd /usr/local/src/
上傳安裝包并解壓
tar -zxvf apr-1.7.4.tar.gz
chown -R root.root apr-1.7.4
cd apr-1.7.4/
./configure --prefix=/usr/local/apr
報錯:
在/usr/bin下執(zhí)行l(wèi)s -l |grep ld有一個叫l(wèi)d.gold的文件
mv /usr/bin/ld /usr/bin/ld.bak
ln -s /usr/bin/ld.gold /usr/bin/ld
繼續(xù)執(zhí)行./configure --prefix=/usr/local/apr
報錯如下
將configure 文件中RM='$RM' 修改為RM='$RM -f'
vim configure
繼續(xù)執(zhí)行./configure --prefix=/usr/local/apr
執(zhí)行成功,繼續(xù)下一步
make && make install
安裝成功如下:
4、編譯安裝apr-util
cd /usr/local/src
上傳包并解壓
先安裝依賴
yum install -y expat-devel
cd apr-util-1.6.3
chown -R root.root apr-util-1.6.3
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config
執(zhí)行成功
make && make install
安裝成功
5、編譯安裝prce
tar -zxvf pcre-8.35.tar.gz
chown -R root.root pcre-8.35
cd pcre-8.35
./configure --prefix=/usr/local/pcre
make && make install
6、編譯安裝apache
cd /usr/local/src
上傳包
tar -zxvf httpd-2.4.57.tar.gz
chown -R root.root httpd-2.4.57
cd httpd-2.4.57
./configure --prefix=/usr/local/httpd --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre/bin/pcre-config
make && make install
安裝完成
二、老版本httpd卸載
yum list | grep httpd
systemctl stop httpd
yum erase httpd.x86_64 -y
三、新版本配置
1.將apachectl命令拷貝到/etc/init.d目錄下,改名為httpd
cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd
2.編輯/etc/init.d/httpd文件,在第1行#!/bin/sh的后面添加如下兩行
# chkconfig: 2345 70 30
# description: Apache
3.Apache服務尚未被添加到chkconfig列表中,需要使用--add參數(shù)將其添加進去
chkconfig --add httpd
chkconfig --list httpd
4.添加httpd命令
cp /usr/local/httpd/bin/httpd /sbin/
5.啟動
systemctl start httpd
systemctl status httpd
6.版本查看
httpd -V文章來源:http://www.zghlxwxcb.cn/news/detail-800650.html
文章來源地址http://www.zghlxwxcb.cn/news/detail-800650.html
到了這里,關于Apache-httpd最新版本升級教程的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網(wǎng)!