【阿里云镜像】更改阿里巴巴开源镜像站镜像之——CentOS镜像

前言

阿里巴巴 OPSX 开源镜像站,提供 CentOS、Debian、Ubuntu、 Fedora、Arch Linux、Gentoo、openSUSE、Scientific Linux 等主流发行版的软件源镜像。为阿里云和互联网用户提供免费高速的一站式镜像服务
一、什么是阿里巴巴开源镜像站 【【阿里云镜像】更改阿里巴巴开源镜像站镜像之——CentOS镜像】镜像站官网:阿里巴巴镜像站链接
【阿里云镜像】更改阿里巴巴开源镜像站镜像之——CentOS镜像
文章图片

二、更换阿里巴巴镜像源操作步骤 参考链接:CentOS镜像
CentOS,是基于 Red Hat Linux 提供的可自由使用源代码的企业级 Linux 发行版本;是一个稳定,可预测,可管理和可复制的免费企业级计算平台。
镜像下载地址:
https://mirrors.aliyun.com/centos/
https://mirrors.aliyun.com/centos-vault/
1、备份自带的YUM源
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
【阿里云镜像】更改阿里巴巴开源镜像站镜像之——CentOS镜像
文章图片

2、下载新的 CentOS-Base.repo 到 /etc/yum.repos.d/ CentOS 7版本:
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/re...
或者
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/re...
[root@centos yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo --2021-11-22 11:07:13--https://mirrors.aliyun.com/repo/Centos-7.repo Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 61.162.46.214, 61.162.46.210, 61.162.46.208, ... Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|61.162.46.214|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 2523 (2.5K) [application/octet-stream] Saving to: ‘/etc/yum.repos.d/CentOS-Base.repo’100%[==============================================================================>] 2,523--.-K/sin 0s2021-11-22 11:07:13 (122 MB/s) - ‘/etc/yum.repos.d/CentOS-Base.repo’ saved [2523/2523][root@centos yum.repos.d]# ll total 40 drwxr-xr-x2 root root6 Nov 22 11:04 backup -rw-r--r--1 root root 2523 Dec 262020 CentOS-Base.repo -rw-r--r--. 1 root root 1664 Nov 232018 CentOS-Base.repo.backup -rw-r--r--. 1 root root 1309 Nov 232018 CentOS-CR.repo -rw-r--r--. 1 root root649 Nov 232018 CentOS-Debuginfo.repo -rw-r--r--. 1 root root314 Nov 232018 CentOS-fasttrack.repo -rw-r--r--. 1 root root630 Nov 232018 CentOS-Media.repo -rw-r--r--1 root root69 Nov 20 07:55 centos.repo.backup -rw-r--r--. 1 root root 1331 Nov 232018 CentOS-Sources.repo -rw-r--r--. 1 root root 5701 Nov 232018 CentOS-Vault.repo [root@centos yum.repos.d]#

【阿里云镜像】更改阿里巴巴开源镜像站镜像之——CentOS镜像
文章图片

3、运行 yum makecache 生成缓存
yum makecache
[root@centos yum.repos.d]# yum makecache Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com base| 3.6 kB00:00:00 extras| 2.9 kB00:00:00 updates| 2.9 kB00:00:00 (1/6): extras/7/x86_64/filelists_db| 259 kB00:00:01 (2/6): extras/7/x86_64/other_db| 145 kB00:00:02 (3/6): base/7/x86_64/other_db| 2.6 MB00:00:02 (4/6): updates/7/x86_64/other_db| 829 kB00:00:01 (5/6): base/7/x86_64/filelists_db| 7.2 MB00:00:06 (6/6): updates/7/x86_64/filelists_db| 6.6 MB00:00:08 Metadata Cache Created [root@centos yum.repos.d]#

【阿里云镜像】更改阿里巴巴开源镜像站镜像之——CentOS镜像
文章图片

4、查看更换的阿里云镜像的仓库是否生效。
yum clean all
yum repolist
[root@centos yum.repos.d]# yum clean all Loaded plugins: fastestmirror Cleaning repos: base extras updates Cleaning up list of fastest mirrors Other repos take up 41 M of disk space (use --verbose for details) [root@centos yum.repos.d]# yum repolist Loaded plugins: fastestmirror Determining fastest mirrors * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com base| 3.6 kB00:00:00 extras| 2.9 kB00:00:00 updates| 2.9 kB00:00:00 (1/4): base/7/x86_64/group_gz| 153 kB00:00:00 (2/4): extras/7/x86_64/primary_db| 243 kB00:00:00 (3/4): updates/7/x86_64/primary_db|12 MB00:00:02 (4/4): base/7/x86_64/primary_db| 6.1 MB00:00:03 repo idrepo namestatus base/7/x86_64CentOS-7 - Base - mirrors.aliyun.com10,072 extras/7/x86_64CentOS-7 - Extras - mirrors.aliyun.com500 updates/7/x86_64CentOS-7 - Updates - mirrors.aliyun.com2,963 repolist: 13,535 [root@centos yum.repos.d]#

更换阿里云镜像站——CentOS镜像生效。
【阿里云镜像】更改阿里巴巴开源镜像站镜像之——CentOS镜像
文章图片

    推荐阅读