centos7yum源配置

2021-06-10  本文已影响0人  waypec

1.配置 阿里云镜像仓库

1.备份

cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

2.下载

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

3.清除缓存

yum clean all     # 清除系统所有的yum缓存
yum makecache     # 生成yum缓存

2、配置 清华大学镜像仓库(推荐)

地址: https://mirrors.cnnic.cn/

1.备份

cp /etc/yum.repos.d/CentOS-Base.repo  /etc/yum.repos.d/CentOS-Base.repo.bak

2.之后启用 TUNA 软件仓库, 将清华大学镜像仓库信息写入 /etc/yum.repos.d/CentOS-Base.repo

sudo sed -e 's|^mirrorlist=|#mirrorlist=|g' \
         -e 's|^#baseurl=http://mirror.centos.org|baseurl=https://mirrors.tuna.tsinghua.edu.cn|g' \
         -i.bak \
         /etc/yum.repos.d/CentOS-*.repo

3.清除缓存

yum clean all     # 清除系统所有的yum缓存
yum makecache     # 生成yum缓存

3.epel源 安装和配置

(1)、查看可用的epel源

yum list | grep epel-release

(2)、安装 epel

yum install -y epel-release

(3)、配置阿里镜像提供的epel源

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

(4)、清除缓存

yum clean all     # 清除系统所有的yum缓存
yum makecache     # 生成yum缓存

4.查看yum源

查看所有的yum源:

yum repolist all

查看可用的yum源:

yum repolist enabled
上一篇 下一篇

猜你喜欢

热点阅读