欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

配置阿里yum源和epel源

程序员文章站 2022-07-03 16:59:42
...

配置阿里的yum源

备份

cd /etc/yum.repos.d/
mkdir bak
mv * ./bak/

下载阿里yum源

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

配置缓存

yum clean all
yum makecache

配置阿里Epel源

简介

EPEL (Extra Packages for Enterprise Linux), 是由 Fedora Special Interest Group 维护的 Enterprise Linux(RHEL、CentOS)中经常用到的包。

配置方法

1. 备份(如有配置其他epel源)

mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup
mv /etc/yum.repos.d/epel-testing.repo /etc/yum.repos.d/epel-testing.repo.backup

2.卸载rpm包

检查下如果有epel的rpm包安装,卸载掉。

[[email protected] yum.repos.d]# rpm -qa|grep epel
epel-release-7-13.noarch
[[email protected] yum.repos.d]# rpm -e --nodeps epel-release-7-13.noarch
warning: file /etc/yum.repos.d/epel.repo: remove failed: No such file or directory
warning: file /etc/yum.repos.d/epel-testing.repo: remove failed: No such file or directory

3. 下载新repo 到/etc/yum.repos.d/

epel(RHEL 7)
1)安装 epel 配置包

yum install -y https://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpm

2)将 repo 配置中的地址替换为阿里云镜像站地址

sed -i 's|^#baseurl=http://download.fedoraproject.org/pub|baseurl=https://mirrors.aliyun.com|' /etc/yum.repos.d/epel*
sed -i 's|^metalink|#metalink|' /etc/yum.repos.d/epel*

不同版本的epel地址

epel(RHEL 7)

wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

epel(RHEL 6)

wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo

epel(RHEL 5)

wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-5.repo
相关标签: linux linux