您好,登錄后才能下訂單哦!
這篇文章給大家分享的是centos7中升級apache版本的方法,相信大部分人都還沒學(xué)會(huì)這個(gè)技能,為了讓大家學(xué)會(huì),給大家總結(jié)了以下內(nèi)容,話不多說,一起往下看吧。
第一步:找出默認(rèn)軟件庫上的Apache版本
為了查找Centos上軟件庫里的Apache版本,在命令行下輸入以下指令:
yum info httpd
如果你的centos保持著默認(rèn)的配置的話,你很可能會(huì)按到類似的結(jié)果:
[root@crosp ~]# yum info httpd Loaded plugins: fastestmirror epel/x86_64/metalink | 19 kB 00:00 epel | 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:00 Loading mirror speeds from cached hostfile * base: mirrors.ircam.fr * epel: mirrors.ircam.fr * extras: centos.mirror.fr.planethoster.net * updates: centos.mirror.fr.planethoster.net Available Packages Name : httpd Arch : x86_64 Version : 2.4.6 Release : 45.el7.centos.4 Size : 2.7 M Repo : updates/7/x86_64 Summary : Apache HTTP Server URL : http://httpd.apache.org/ License : ASL 2.0 Description : The Apache HTTP Server is a powerful, efficient, and extensible : web server.
正如你從上面的輸出結(jié)果中看到,默認(rèn)軟件庫中只有2.4.6版本的apache。
注意:
Centos使用 向后修復(fù)安全實(shí)踐 來將新的軟件修復(fù)應(yīng)用到更早期的版本。所以,默認(rèn)庫中的早期版本軟件不意味著就更脆弱。不過對于我來說,并不算是個(gè)滿足需求的更新。
你可以使用changelog來查看版本更新:
sudo yum install yum-changelog yum changelog httpd
第二步:安裝CodeIT庫
CodeIT的人提供了一個(gè)很好的自定義庫。這個(gè)庫提供了最新版本的服務(wù)器軟件(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
接下來,我們再次確認(rèn)Apache的包版本,你應(yīng)該會(huì)看到類似下面的輸出
[root@crosp ~]# yum info httpd Loaded plugins: changelog, fastestmirror Loading mirror speeds from cached hostfile * base: centos.crazyfrogs.org * epel: mirror.23media.de * extras: mirrors.ircam.fr * updates: centos.mirror.fr.planethoster.net Available Packages Name : httpd Arch : x86_64 Version : 2.4.25 Release : 3.el7.codeit Size : 1.4 M Repo : CodeIT/x86_64 Summary : Apache HTTP Server URL : http://httpd.apache.org/ License : ASL 2.0 Description : The Apache HTTP Server is a powerful, efficient, and extensible : web server.
第三步:安裝Apache
現(xiàn)在你應(yīng)該有了安裝最新版apache所需要的所有東西:
yum install httpd
一旦Apache安裝好,我們就可以測試apache是否正常工作:
[root@crosp ~]# systemctl start httpd
輸出應(yīng)該是類似下圖:
[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設(shè)置為開機(jī)自啟動(dòng):
[root@crosp ~]# systemctl enable httpd
以上就是centos7中升級apache版本的方法,詳細(xì)使用情況還需要大家自己親自動(dòng)手使用過才能領(lǐng)會(huì)。如果想了解更多相關(guān)內(nèi)容,歡迎關(guān)注億速云行業(yè)資訊頻道!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。