Centos配置yum 源 和 epel 源

TanHaX
2022-09-02 / 0 评论 / 272 阅读 / 正在检测是否收录...
由于学校机房的系统环境不太好,所以就写一个小笔记以备不时之需!这里推荐阿里和网易的源。

1.首先备份

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

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

注:如果使用wget不生效可以使用 yum -y install wget 进行安装,或者使用 curl -o 代替wget -O.


(1).下载系统对应版本的repo文件,放入/etc/yum.repos.d/

  • CentOS8
wget https://mirrors.aliyun.com/repo/Centos-8.repo
  • CentOS7

    wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
    wget https://mirrors.aliyun.com/repo/Centos-7.repo
  • CentOS6

    wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
    wget https://mirrors.aliyun.com/repo/Centos-6.repo
  • CentOS5

    wget http://mirrors.163.com/.help/CentOS5-Base-163.repo
    wget https://mirrors.aliyun.com/repo/Centos-5.repo
    

(2). 安装epel源,这里提供两种安装方式

  1. 方式一
yum install -y epel-release
  1. 方式二,这里也是需要选择下载系统对应版本的eoel文件.
wget http://mirrors.aliyun.com/repo/epel-7.repo
wget http://mirrors.aliyun.com/repo/epel-6.repo
wget http://mirrors.aliyun.com/repo/epel-5.repo


3.下载对应的repo文件后,还需清除系统yum缓存并更新新的yum缓存

yum clean all
yum makecache
如需更详细的源文件可以在 :阿里repo镜像
6

打赏

评论 (0)

取消