<!-正在加载刚性遮罩-> < div id =' loading ' >

centos7配置yum源

​ centos7配置yum源

配置本地源

  1. 挂载系统镜像到指定目录

mount /dev/sr0 /mnt

  1. 切换到/etc/yum.repos.d/目录

cd /etc/yum.repos.d/

  1. 编辑配置文件

vim CentOS-Base.repo

添加以下内容

[local]
name=localyum   #自定义名称
baseurl=file:///mnt  #本地光盘挂载路径
enabled=1     #启用yum源,0为不启用,1为启用
gpgcheck=0    #检查GPG-KEY,0为不检查,1为检查
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

:wq! #保存退出

阿里云镜像源

  1. 备份
mv /etc/yum.repos.d/CentOS-Base.repo  /etc/yum.repos.d/CentOS-Base.repo.backup
  1. 下载新的CentOS-Base.repo 到/etc/yum.repos.d/

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

  1. 清除缓存、生成缓存、升级更新

yum clean all

yum makecache

yum -y update

阿里云官方镜像站

https://developer.aliyun.com/mirror/

posted @ 2020-06-29 16:19  xrg  阅读(576)  评论(0编辑  收藏  举报