阿里云镜像更改阿里巴巴开源镜像站镜像之——CentOS镜像
Posted xuyebao
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了阿里云镜像更改阿里巴巴开源镜像站镜像之——CentOS镜像相关的知识,希望对你有一定的参考价值。
@TOC
前言
一、什么是阿里巴巴开源镜像站
镜像站官网:阿里巴巴镜像站链接
二、更换阿里巴巴镜像源操作步骤
参考链接:CentOS镜像
镜像下载地址:
https://mirrors.aliyun.com/centos/
https://mirrors.aliyun.com/centos-vault/
1、备份自带的YUM源
2、下载新的 CentOS-Base.repo 到 /etc/yum.repos.d/
CentOS 7版本:
或者
[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/s in 0s
2021-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-x 2 root root 6 Nov 22 11:04 backup
-rw-r--r-- 1 root root 2523 Dec 26 2020 CentOS-Base.repo
-rw-r--r--. 1 root root 1664 Nov 23 2018 CentOS-Base.repo.backup
-rw-r--r--. 1 root root 1309 Nov 23 2018 CentOS-CR.repo
-rw-r--r--. 1 root root 649 Nov 23 2018 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root 314 Nov 23 2018 CentOS-fasttrack.repo
-rw-r--r--. 1 root root 630 Nov 23 2018 CentOS-Media.repo
-rw-r--r-- 1 root root 69 Nov 20 07:55 centos.repo.backup
-rw-r--r--. 1 root root 1331 Nov 23 2018 CentOS-Sources.repo
-rw-r--r--. 1 root root 5701 Nov 23 2018 CentOS-Vault.repo
[root@centos yum.repos.d]#
3、运行 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 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/6): extras/7/x86_64/filelists_db | 259 kB 00:00:01
(2/6): extras/7/x86_64/other_db | 145 kB 00:00:02
(3/6): base/7/x86_64/other_db | 2.6 MB 00:00:02
(4/6): updates/7/x86_64/other_db | 829 kB 00:00:01
(5/6): base/7/x86_64/filelists_db | 7.2 MB 00:00:06
(6/6): updates/7/x86_64/filelists_db | 6.6 MB 00:00:08
Metadata Cache Created
[root@centos yum.repos.d]#
4、查看更换的阿里云镜像的仓库是否生效。
[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 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/4): base/7/x86_64/group_gz | 153 kB 00:00:00
(2/4): extras/7/x86_64/primary_db | 243 kB 00:00:00
(3/4): updates/7/x86_64/primary_db | 12 MB 00:00:02
(4/4): base/7/x86_64/primary_db | 6.1 MB 00:00:03
repo id repo name status
base/7/x86_64 CentOS-7 - Base - mirrors.aliyun.com 10,072
extras/7/x86_64 CentOS-7 - Extras - mirrors.aliyun.com 500
updates/7/x86_64 CentOS-7 - Updates - mirrors.aliyun.com 2,963
repolist: 13,535
[root@centos yum.repos.d]#
更换阿里云镜像站——CentOS镜像生效。
以上是关于阿里云镜像更改阿里巴巴开源镜像站镜像之——CentOS镜像的主要内容,如果未能解决你的问题,请参考以下文章