CentOS更换yum源

在此之前,可以先了解下:

yum的repo文件详解、以及epel简介、yum源的更换

一、操作步骤

1. 备份原始的yum源

# 进入repo目录
cd /etc/yum.repos.d

# 备份Base.repo
cp CentOS-Base.repo CentOS-Base.repo.bak

2. 下载对应版本的repo文件

注意这里下载的是Centos-8的

# 下载阿里云的: 注意下载后的文件名字设置成了默认的,CentOS-Base.repo
wget -O CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo
# 或者下载腾讯云的
wget -O CentOS-Base.repo https://mirrors.tencent.com/repo/centos8_base.repo

3. 清除旧的yum缓存并生成新的yum缓存

yum clean all
yum makecache

4. 更新

yum update -y

二、扩展

1.如何查看自己的版本

hostnamectl

# 输出
  Operating System: CentOS Linux 8 (Core)
       CPE OS Name: cpe:/o:centos:centos:8
            Kernel: Linux 4.18.0-305.3.1.el8.x86_64
      Architecture: x86-64

2.如何查看其他版本的yum源

阿里云repo: https://mirrors.aliyun.com/repo

阿里云镜像仓库: https://mirrors.aliyun.com

腾讯云repo:https://mirrors.tencent.com/repo

腾讯云镜像仓库:https://mirrors.tencent.com

3./etc/yum.repos.d下面文件太多,可以删除不?

可以删除,重新执行第一节的操作就好了,更新后会重新拉缓存文件的。

image-20230208221949904

4.腾讯云和阿里云哪个好用点?

哈哈,你猜腾讯云怎么看.

image-20230208221731372

5.其他软件加速

这个要去看官方文档,比如腾讯的在这里。

腾讯云软件源加速软件包下载和更新

posted @ 2023-02-08 22:22  羊37  阅读(317)  评论(0编辑  收藏  举报