一、源起
因为在阿里云的ECS快要到期了,刚好华为云这边在搞活动,所以就想尝试下华为云的产品,看下好不好用,于是下单买了一台HECS云耀云服务器
一般拿到服务器之后呢会习惯性会先更新一下系统1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19[root@myhost ~]# yum update -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
epel/x86_64/metalink | 2.8 kB 00:00:00
* base: mirrors.cn99.com
* epel: ftp.jaist.ac.jp
* extras: ftp.sjtu.edu.cn
* updates: ftp.sjtu.edu.cn
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
jenkins | 2.9 kB 00:00:00
nginx | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/2): epel/x86_64/updateinfo | 1.0 MB 00:00:17
^C/2): epel/x86_64/primary_db 71% [=============================- ] 8.3 kB/s | 5.6 MB 00:04:38 ETA
Exiting on user cancel
发现等了好久都还没好,看了下速度,8.3 kB/s,这速度实在太慢了,忍受不了,马上看了下yum的源,使用的主要是网易开源镜像站,还有日本的北陸先端科学技術大学院大学和国内的上海交通大学,为什么不换成国内比较快的阿里云的源呢?开始动手吧!
二、开干
先备份原来的源配置文件1
2[root@myhost ~]# cd /etc/yum.repos.d
[root@myhost yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.bak
下载阿里云的源1
2
3
4
5
6
7
8
9
10
11[root@myhost yum.repos.d]# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/Centos-7.repo
--2020-03-28 09:40:59-- http://mirrors.aliyun.com/repo/Centos-7.repo
Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 180.122.78.243, 180.122.78.240, 180.122.78.239, ...
Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|180.122.78.243|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2523 (2.5K) [application/octet-stream]
Saving to: '/etc/yum.repos.d/epel.repo'
[============================================================================================>] 2,523 --.-K/s in 0s
2020-03-28 09:40:59 (439 MB/s) - '/etc/yum.repos.d/epel.repo' saved [2523/2523]
测试一下1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57[root@myhost yum.repos.d]# yum clean all
Loaded plugins: fastestmirror
Cleaning repos: base docker-ce-stable extras jenkins nginx openresty updates
Cleaning up list of fastest mirrors
Other repos take up 64 M of disk space (use --verbose for details)
[root@myhost yum.repos.d]# yum makecache
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
docker-ce-stable | 3.5 kB 00:00:00
extras | 2.9 kB 00:00:00
jenkins | 2.9 kB 00:00:00
nginx | 2.9 kB 00:00:00
openresty | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/23): base/7/x86_64/group_gz | 153 kB 00:00:00
(2/23): base/7/x86_64/filelists_db | 7.1 MB 00:00:02
(3/23): base/7/x86_64/primary_db | 6.1 MB 00:00:02
(4/23): base/7/x86_64/other_db | 2.6 MB 00:00:00
(5/23): docker-ce-stable/x86_64/updateinfo | 55 B 00:00:00
(6/23): docker-ce-stable/x86_64/filelists_db | 21 kB 00:00:00
(7/23): docker-ce-stable/x86_64/primary_db | 45 kB 00:00:00
(8/23): docker-ce-stable/x86_64/other_db | 114 kB 00:00:00
(9/23): extras/7/x86_64/filelists_db | 217 kB 00:00:00
(10/23): extras/7/x86_64/other_db | 124 kB 00:00:00
(11/23): extras/7/x86_64/primary_db | 206 kB 00:00:00
(12/23): jenkins/primary_db | 155 kB 00:00:03
(13/23): nginx/x86_64/filelists_db | 76 kB 00:00:00
(14/23): nginx/x86_64/primary_db | 55 kB 00:00:01
(15/23): nginx/x86_64/other_db | 32 kB 00:00:00
(16/23): openresty/7/x86_64/primary_db | 60 kB 00:00:00
(17/23): openresty/7/x86_64/other_db | 33 kB 00:00:00
(18/23): openresty/7/x86_64/filelists_db | 122 kB 00:00:00
(19/23): jenkins/filelists_db | 96 kB 00:00:07
(20/23): updates/7/x86_64/primary_db | 4.5 MB 00:00:02
(21/23): updates/7/x86_64/other_db | 316 kB 00:00:00
(22/23): updates/7/x86_64/filelists_db | 2.4 MB 00:00:02
(23/23): jenkins/other_db | 249 kB 00:00:12
Metadata Cache Created
[root@myhost yum.repos.d]# yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
repo id repo name status
base/7/x86_64 CentOS-7 - Base - mirrors.aliyun.com 10,070
docker-ce-stable/x86_64 Docker CE Stable - x86_64 79
extras/7/x86_64 CentOS-7 - Extras - mirrors.aliyun.com 413
jenkins Jenkins 581
nginx/x86_64 nginx repo 192
openresty/7/x86_64 Official OpenResty Open Source Repository for CentOS 217
updates/7/x86_64 CentOS-7 - Updates - mirrors.aliyun.com 1,127
repolist: 12,679
除了jenkins/other_db这个的速度稍微慢一点之外,其他都是一下子就好了,心情瞬间变得美美的。
三、疑问
既然都已经把在CentOS的镜像里面添加了CloudResetPwdUpdateAgent、CloudrResetPwdAgent这些程序了,为啥不修改一下一些可以提高用户体验的细节地方呢?
比如把这个yum的源换一下,就不需要像我一样承受开始的时候慢得像只蜗牛一样的速度之痛了。
本站版权使用署名-非商业性使用-禁止演绎 4.0 国际,转载请保留原文链接及作者。