“Yum配置源”的版本间的差异
跳到导航
跳到搜索
Jihongchang(讨论 | 贡献) (建立内容为“=== 备份 === <syntaxhighlight lang="shell-session"> [root@iZ8vbcjkeqbrdmmbt23vboZ yum.repos.d]# ls -lh total 12K -rw-r--r-- 1 root root 675 Nov 28 2021 CentOS…”的新页面) |
Jihongchang(讨论 | 贡献) |
||
第1行: | 第1行: | ||
+ | 参考:https://developer.aliyun.com/mirror/centos | ||
+ | |||
=== 备份 === | === 备份 === | ||
<syntaxhighlight lang="shell-session"> | <syntaxhighlight lang="shell-session"> | ||
第13行: | 第15行: | ||
-rw-r--r-- 1 root root 230 Nov 28 2021 epel.repo | -rw-r--r-- 1 root root 230 Nov 28 2021 epel.repo | ||
[root@iZ8vbcjkeqbrdmmbt23vboZ yum.repos.d]# | [root@iZ8vbcjkeqbrdmmbt23vboZ yum.repos.d]# | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | === 下载新的 CentOS-Base.repo 到 /etc/yum.repos.d/ === | ||
+ | CentOS 7<syntaxhighlight lang="shell-session"> | ||
+ | [root@iZ8vbcjkeqbrdmmbt23vboZ yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo | ||
+ | --2022-08-17 06:02:18-- https://mirrors.aliyun.com/repo/Centos-7.repo | ||
+ | Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 220.181.158.239, 220.181.158.242, 220.181.158.243, ... | ||
+ | Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|220.181.158.239|: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 0.02s | ||
+ | |||
+ | 2022-08-17 06:02:18 (110 KB/s) - ‘/etc/yum.repos.d/CentOS-Base.repo’ saved [2523/2523] | ||
+ | |||
+ | [root@iZ8vbcjkeqbrdmmbt23vboZ yum.repos.d]# ls -lh | ||
+ | total 16K | ||
+ | -rw-r--r-- 1 root root 2.5K Aug 4 15:04 CentOS-Base.repo | ||
+ | -rw-r--r-- 1 root root 675 Nov 28 2021 CentOS-Base.repo.backup | ||
+ | -rw-r--r-- 1 root root 1.9K Nov 22 2021 docker-ce.repo | ||
+ | -rw-r--r-- 1 root root 230 Nov 28 2021 epel.repo | ||
+ | [root@iZ8vbcjkeqbrdmmbt23vboZ yum.repos.d]# | ||
+ | |||
+ | </syntaxhighlight> | ||
+ | |||
+ | === 运行 yum makecache 生成缓存 === | ||
+ | <syntaxhighlight lang="shell-session"> | ||
+ | [root@iZ8vbcjkeqbrdmmbt23vboZ yum.repos.d]# yum makecache | ||
+ | Loaded plugins: fastestmirror | ||
+ | Loading mirror speeds from cached hostfile | ||
+ | * base: mirrors.cloud.aliyuncs.com | ||
+ | * extras: mirrors.cloud.aliyuncs.com | ||
+ | * updates: mirrors.cloud.aliyuncs.com | ||
+ | base | 3.6 kB 00:00:00 | ||
+ | docker-ce-stable | 3.5 kB 00:00:00 | ||
+ | epel | 4.7 kB 00:00:00 | ||
+ | extras | 2.9 kB 00:00:00 | ||
+ | updates | 2.9 kB 00:00:00 | ||
+ | (1/10): epel/x86_64/prestodelta | 553 B 00:00:00 | ||
+ | (2/10): base/7/x86_64/other_db | 2.6 MB 00:00:00 | ||
+ | (3/10): extras/7/x86_64/filelists_db | 277 kB 00:00:00 | ||
+ | (4/10): epel/x86_64/other_db | 3.4 MB 00:00:00 | ||
+ | (5/10): extras/7/x86_64/other_db | 148 kB 00:00:00 | ||
+ | (6/10): updates/7/x86_64/other_db | 1.1 MB 00:00:00 | ||
+ | (7/10): updates/7/x86_64/filelists_db | 9.4 MB 00:00:00 | ||
+ | (8/10): docker-ce-stable/7/x86_64/filelists_db | 33 kB 00:00:01 | ||
+ | (9/10): docker-ce-stable/7/x86_64/other_db | 125 kB 00:00:01 | ||
+ | (10/10): epel/x86_64/filelists_db | 12 MB 00:00:01 | ||
+ | Metadata Cache Created | ||
+ | [root@iZ8vbcjkeqbrdmmbt23vboZ yum.repos.d]# | ||
+ | |||
</syntaxhighlight> | </syntaxhighlight> |
2022年8月16日 (二) 22:03的最新版本
参考:https://developer.aliyun.com/mirror/centos
备份
[root@iZ8vbcjkeqbrdmmbt23vboZ yum.repos.d]# ls -lh
total 12K
-rw-r--r-- 1 root root 675 Nov 28 2021 CentOS-Base.repo
-rw-r--r-- 1 root root 1.9K Nov 22 2021 docker-ce.repo
-rw-r--r-- 1 root root 230 Nov 28 2021 epel.repo
[root@iZ8vbcjkeqbrdmmbt23vboZ yum.repos.d]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
[root@iZ8vbcjkeqbrdmmbt23vboZ yum.repos.d]# ls -lh
total 12K
-rw-r--r-- 1 root root 675 Nov 28 2021 CentOS-Base.repo.backup
-rw-r--r-- 1 root root 1.9K Nov 22 2021 docker-ce.repo
-rw-r--r-- 1 root root 230 Nov 28 2021 epel.repo
[root@iZ8vbcjkeqbrdmmbt23vboZ yum.repos.d]#
下载新的 CentOS-Base.repo 到 /etc/yum.repos.d/
CentOS 7
[root@iZ8vbcjkeqbrdmmbt23vboZ yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
--2022-08-17 06:02:18-- https://mirrors.aliyun.com/repo/Centos-7.repo
Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 220.181.158.239, 220.181.158.242, 220.181.158.243, ...
Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|220.181.158.239|: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 0.02s
2022-08-17 06:02:18 (110 KB/s) - ‘/etc/yum.repos.d/CentOS-Base.repo’ saved [2523/2523]
[root@iZ8vbcjkeqbrdmmbt23vboZ yum.repos.d]# ls -lh
total 16K
-rw-r--r-- 1 root root 2.5K Aug 4 15:04 CentOS-Base.repo
-rw-r--r-- 1 root root 675 Nov 28 2021 CentOS-Base.repo.backup
-rw-r--r-- 1 root root 1.9K Nov 22 2021 docker-ce.repo
-rw-r--r-- 1 root root 230 Nov 28 2021 epel.repo
[root@iZ8vbcjkeqbrdmmbt23vboZ yum.repos.d]#
运行 yum makecache 生成缓存
[root@iZ8vbcjkeqbrdmmbt23vboZ yum.repos.d]# yum makecache
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.cloud.aliyuncs.com
* extras: mirrors.cloud.aliyuncs.com
* updates: mirrors.cloud.aliyuncs.com
base | 3.6 kB 00:00:00
docker-ce-stable | 3.5 kB 00:00:00
epel | 4.7 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/10): epel/x86_64/prestodelta | 553 B 00:00:00
(2/10): base/7/x86_64/other_db | 2.6 MB 00:00:00
(3/10): extras/7/x86_64/filelists_db | 277 kB 00:00:00
(4/10): epel/x86_64/other_db | 3.4 MB 00:00:00
(5/10): extras/7/x86_64/other_db | 148 kB 00:00:00
(6/10): updates/7/x86_64/other_db | 1.1 MB 00:00:00
(7/10): updates/7/x86_64/filelists_db | 9.4 MB 00:00:00
(8/10): docker-ce-stable/7/x86_64/filelists_db | 33 kB 00:00:01
(9/10): docker-ce-stable/7/x86_64/other_db | 125 kB 00:00:01
(10/10): epel/x86_64/filelists_db | 12 MB 00:00:01
Metadata Cache Created
[root@iZ8vbcjkeqbrdmmbt23vboZ yum.repos.d]#