CentOS7修改为国内yum源

我们两清 提交于 2020-01-26 13:24:12
  1. 备份源yum源
    如果是国内下载的CentOS很可能国内YUM源已经设置好了。
    备份/etc/yum.repos.d/下的*.repo文件。

  2. 在CentOS中配置使用网易和阿里的开源镜像
    wget http://mirrors.aliyun.com/repo/Centos-7.repo
    wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
    或者手动下载repo文件并上传到/etc/yum.repos.d/目录

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

  4. 安装epel源
    yum list | grep epel-release
    yum install -y epel-release

  5. 再次清除系统yum缓存,并重新生成新的yum缓存
    yum clean all
    yum makecache

  6. 查看系统可用的yum源和所有的yum源
    yum repolist enabled
    yum repolist all

  7. 测试安装
    yum install openssh-server

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!