yum install 沒有可用軟件包 nginx。

一:報錯

已加載插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.lzu.edu.cn
 * extras: mirror.lzu.edu.cn
 * updates: mirror.lzu.edu.cn
沒有可用軟件包 nginx。
錯誤:無須任何處理

在CentOS 7.3 x86_64下安裝nginx的時候出現(xiàn)了問題:Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again,需要安裝epel源。

二:解決方法

1.更改epel.repo文件

一句話:把/etc/yum.repos.d/epel.repo,文件第3行注釋去掉,把第四行注釋掉。具體如下:
打開/etc/yum.repos.d/epel.repo,變成如下格式


  1 [epel]
  2 name=Extra Packages for Enterprise Linux 7 - $basearch
  3 baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch
  4 #metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch
  5 failovermethod=priority
  6 enabled=1
  7 gpgcheck=1
  8 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7

再清理源,重新安裝

$yum clean all
$yum install -y epel-release

發(fā)現(xiàn)沒卵用

3.更新ca-certficates包

$yum clean all
$yum --disablerepo=epel -y update  ca-certificates

發(fā)現(xiàn)沒什么卵用

3.將https轉(zhuǎn)為http

$cp /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.bak
$sed -i 's#https://#http://#g' /etc/yum.repos.d/epel.repo

發(fā)現(xiàn)還是沒卵用

4.更改resolv.conf文件

如果還是不行,修改DNS,到/etc/resolv.conf下添加下面兩句,把你原來的注釋掉:

nameserver 8.8.8.8
search localdomain

然后重啟network服務(wù):service network restart
最后發(fā)現(xiàn)可以了。

三:安裝nginx

$sudo yum install epel-release
$yum update
$yum install -y nginx

搞定了。


最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容