您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息
免费发信息
三六零分类信息网 > 金昌分类信息网,免费分类信息发布

centos7下升级apache至最新版本

2024/6/1 4:32:29发布23次查看
第一步:找出默认软件库上的apache版本
为了查找centos上软件库里的apache版本,在命令行下输入以下指令:
yum info httpd
如果你的centos保持着默认的配置的话,你很可能会按到类似的结果:
[root@crosp ~]# yum info httpdloaded plugins: fastestmirrorepel/x86_64/metalink | 19 kb 00:00epel | 4.3 kb 00:00(1/3): epel/x86_64/group_gz | 170 kb 00:00(2/3): epel/x86_64/primary_db | 4.6 mb 00:00(3/3): epel/x86_64/updateinfo | 780 kb 00:00loading mirror speeds from cached hostfile * base: mirrors.ircam.fr * epel: mirrors.ircam.fr * extras: centos.mirror.fr.planethoster.net * updates: centos.mirror.fr.planethoster.netavailable packagesname : httpdarch : x86_64version : 2.4.6release : 45.el7.centos.4size : 2.7 mrepo : updates/7/x86_64summary : apache http serverurl : http://httpd.apache.org/license : asl 2.0description : the apache http server is a powerful, efficient, and extensible : web server.
正如你从上面的输出结果中看到,默认软件库中只有2.4.6版本的apache。
注意:
centos使用 向后修复安全实践 来将新的软件修复应用到更早期的版本。所以,默认库中的早期版本软件不意味着就更脆弱。不过对于我来说,并不算是个满足需求的更新。
你可以使用changelog来查看版本更新:
sudo yum install yum-changelogyum changelog httpd
第二步:安装codeit库
codeit的人提供了一个很好的自定义库。这个库提供了最新版本的服务器软件(apache & nginx)。
在安装codeit库之前,你需要开启 epel 。epel提供了codeit库需要的依赖。
sudo yum install -y epel-release
最后,我们来安装codeit库
cd /etc/yum.repos.d && wget https://repo.codeit.guru/codeit.el`rpm -q --qf "%{version}" $(rpm -q --whatprovides redhat-release)`.repo
接下来,我们再次确认apache的包版本,你应该会看到类似下面的输出
[root@crosp ~]# yum info httpdloaded plugins: changelog, fastestmirrorloading mirror speeds from cached hostfile * base: centos.crazyfrogs.org * epel: mirror.23media.de * extras: mirrors.ircam.fr * updates: centos.mirror.fr.planethoster.netavailable packagesname : httpdarch : x86_64version : 2.4.25release : 3.el7.codeitsize : 1.4 mrepo : codeit/x86_64summary : apache http serverurl : http://httpd.apache.org/license : asl 2.0description : the apache http server is a powerful, efficient, and extensible : web server.
第三步:安装apache
现在你应该有了安装最新版apache所需要的所有东西:
yum install httpd
一旦apache安装好,我们就可以测试apache是否正常工作:
[root@crosp ~]# systemctl start httpd
输出应该是类似下图:
[root@crosp ~]# curl localhost<!doctype html public "-//w3c//dtd xhtml 1.1//en" "http://www.w3.org/tr/xhtml11/dtd/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head><title>test page for the apache http server on centos</title><meta http-equiv="content-type" content="text/html; charset=utf-8" /> ...
最后,让systemctl将apache设置为开机自启动:
[root@crosp ~]# systemctl enable httpd
完成。
推荐教程:apache从入门到精通
以上就是centos7下升级apache至最新版本的详细内容。
金昌分类信息网,免费分类信息发布

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录