如何解決yum無法安裝epel-release的問題
yum無法安裝epel-release
在學(xué)習(xí)Hadoop的過程中準備環(huán)境時需要安裝epel-release
在安裝之前ping了一下www.baidu.com 發(fā)現(xiàn)能ping通,然后就去安裝了,然后就發(fā)現(xiàn)問題了

去網(wǎng)上搜了一下然后感覺應(yīng)該是鏡像源的問題,
嘗試了第一種方法
修改了/etc/yum.repos.d目錄下的CentOS-Base.rep文件,將文件中的原有內(nèi)容改為
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
#baseurl=http://vault.centos.org/7.9.2009/x86_64/os/
baseurl=http://vault.centos.org/7.9.2009/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
#baseurl=http://vault.centos.org/7.9.2009/x86_64/os/
baseurl=http://vault.centos.org/7.9.2009/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
#$baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
#baseurl=http://vault.centos.org/7.9.2009/x86_64/os/
baseurl=http://vault.centos.org/7.9.2009/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
#baseurl=http://vault.centos.org/7.9.2009/x86_64/os/
baseurl=http://vault.centos.org/7.9.2009/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7然后執(zhí)行
sudo yum clean all sudo yum makecache
然后我的這兩個命令就都加載失敗了,我覺得就是這個不行
但是我把后續(xù)的解決方法放到下面,有人成功了可以繼續(xù)往下試試
再執(zhí)行
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
然后查看一下CentOS-Base.repo`中的地址是否改成阿里云的了
cat CentOS-Base.repo`
再此嘗試導(dǎo)入wget命令 好的成功了
第二種方法(我就是用這種方法解決的)
#建議是備份一下 rm -rf /etc/yum.repos.d mkdir /etc/yum.repos.d wget http://mirrors.aliyun.com/repo/Centos-7.repo cp Centos-7.repo /etc/yum.repos.d/CentOS-Base.repo #安裝 rpm -ivh wget-1.14-15.el7_4.1.x86_64.rpm yum clean all yum makecache


總結(jié)
以上為個人經(jīng)驗,希望能給大家一個參考,也希望大家多多支持腳本之家。
相關(guān)文章
Linux printf如何將十進制轉(zhuǎn)換為十六進制
文章總結(jié):介紹了十進制、十六進制和八進制之間的轉(zhuǎn)換方法,包括使用\b命令和bc工具進行轉(zhuǎn)換的技巧2024-12-12
linux下建站目錄分配權(quán)限的經(jīng)驗技巧總結(jié)
在建站的時候給目錄分配權(quán)限是非常重要的,也是建站的程序員們必須要會的,下面這篇文章主要給大家總結(jié)了在linux下建站目錄分配權(quán)限的經(jīng)驗技巧,需要的朋友可以參考借鑒,下面來一起看看吧。2017-06-06
使用apachetop實時監(jiān)控日志、動態(tài)分析服務(wù)器運行狀態(tài)
這篇文章主要介紹了使用apachetop實時監(jiān)控日志、動態(tài)分析服務(wù)器運行狀態(tài),通過apachetop這個工具可以動態(tài)的查看apache的日志文件,還可以直觀的看到訪問的每個地址的請求數(shù)、速度及流量等信息,需要的朋友可以參考下2014-06-06
linux Apache服務(wù)器系統(tǒng)安全設(shè)置與優(yōu)化
結(jié)合,mod_gzip 和緩沖工具等,我們完全可以使一臺配置較低的 PC 有足夠的能力處理各種 HTML/CGI 等的請求。2008-07-07

