centos 7 安装国内阿里云yum源

cd /etc/yum.repos.d/
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
vi CentOS-Base.repo
yum clean all
yum makecache
yum update
history
yum list | grep epel-release
yum install -y epel-release
wget -O /etc/yum.repos.d/epel-7.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum clean all
yum makecache
yum update
yum repolist all
yum repolist enabled

 

 

 

2.1.1、配置步骤

根据官网的说明,我们详细说说每步骤的意思。

(1)、备份,将 CentOS-Base.repo 为CentOS-Base.repo.backup

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
1
(2)、下载新的 http://mirrors.aliyun.com/repo/Centos-7.repo,并命名为CentOS-Base.repo

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
或者
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
1
2
3
(3)、清除缓存

yum clean all # 清除系统所有的yum缓存
yum makecache # 生成yum缓存
yum update
1
2
3
2.1.2、epel源 安装和配置

(1)、查看可用的epel源

[java@localhost yum.repos.d]$ yum list | grep epel-release
epel-release.noarch 7-11 extras
[java@localhost yum.repos.d]$
1
2
3
(2)、安装 epel

[java@localhost yum.repos.d]$ yum install -y epel-release
......省略.....
1
2
(3)、配置阿里镜像提供的epel源

wget -O /etc/yum.repos.d/epel-7.repo http://mirrors.aliyun.com/repo/epel-7.repo
1
4、清除缓存

yum clean all # 清除系统所有的yum缓存
yum makecache # 生成yum缓存
yum update
1
2
3
2.1.3、查看yum源

查看所有的yum源:

yum repolist all
1
查看可用的yum源:

yum repolist enabled
————————————————
版权声明:本文为CSDN博主「xiaojin21cen」的原创文章,遵循 CC 4.0 BY 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/xiaojin21cen/article/details/84726193

上一篇:fdisk新建磁盘分区


下一篇:No package vconfig available安装软件提示找不到可用包linux,linux如何安装vconfig