找回密码
 立即注册

腾讯轻云CentOS7更换源

[复制链接]
69伙伴 发表于 2022-1-20 17:33:18 | 显示全部楼层 |阅读模式
腾讯自家的源少一些东西,换!
yum的配置文件
yum 的配置文件在 /etc/yum.repos.d 目录下,
其中有多个配置文件,每一个配置文件中都可以配置一个或多个repository,
但是最终会被合并为一个交给系统,所以多个文件只是为了方便管理。

先清理下 /etc/yum.repos.d 目录 把里面的内容删光。
  1. 先进入文件夹看看里面的东西多不
  2. cd /etc/yum.repos.d
  3. 在删除yum.repos.d里的所有东西
  4. rm -rf *
复制代码


新建.repo
  1. vim /etc/yum.repos.d/CentOS-Base.repo
复制代码

内容为

  1. # CentOS-Base.repo
  2. #
  3. # The mirror system uses the connecting IP address of the client and the
  4. # update status of each mirror to pick mirrors that are updated to and
  5. # geographically close to the client.  You should use this for CentOS updates
  6. # unless you are manually picking other mirrors.
  7. #
  8. # If the mirrorlist= does not work for you, as a fall back you can try the
  9. # remarked out baseurl= line instead.
  10. #
  11. #

  12. [base]
  13. name=CentOS-$releasever - Base
  14. baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/os/$basearch/
  15. #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
  16. gpgcheck=1
  17. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

  18. #released updates
  19. [updates]
  20. name=CentOS-$releasever - Updates
  21. baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/updates/$basearch/
  22. #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
  23. gpgcheck=1
  24. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

  25. #additional packages that may be useful
  26. [extras]
  27. name=CentOS-$releasever - Extras
  28. baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/extras/$basearch/
  29. #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
  30. gpgcheck=1
  31. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

  32. #additional packages that extend functionality of existing packages
  33. [centosplus]
  34. name=CentOS-$releasever - Plus
  35. baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/centosplus/$basearch/
  36. #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
  37. gpgcheck=1
  38. enabled=0
  39. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
复制代码




3、epel源 安装和配置
(1)、可忽略 查看可用的epel源
  1. yum list | grep epel-release
复制代码

显示内容为 :epel-release.noarch                         7-11                       extras   

(2)、安装 epel
  1. yum install -y epel-release
复制代码


(3)、配置阿里镜像提供的epel源
  1. wget -O /etc/yum.repos.d/epel-7.repo  http://mirrors.aliyun.com/repo/epel-7.repo
复制代码


(4)、清除缓存
  1. yum clean all     # 清除系统所有的yum缓存
  2. yum makecache     # 生成yum缓存
复制代码


3.1、查看yum源
查看所有的yum源:
  1. yum repolist all
复制代码

查看可用的yum源:
  1. yum repolist enabled
复制代码
临时交流 ⇨点我留言
【附件·直下】非必要·勿注册

网格·联系我们 ( 京ICP备16001788号|京公网安备 11010502049360号 ) | 网站地图 | 2012- WGPro.CoM |

GMT+8, 2024-11-23 17:32

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表