centos7中 yum的安装
[root@hear oracle]# cd /etc/yum.repos.d/
[root@hear yum.repos.d]# ls
redhat.repo
[root@hear yum.repos.d]# wget http://mirrors.aliyun.com/repo/Centos-7.repo
--2019-12-12 16:13:50-- http://mirrors.aliyun.com/repo/Centos-7.repo
Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 27.185.6.243, 27.185.6.239, 27.185.5.240, ...
Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|27.185.6.243|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2523 (2.5K) [application/octet-stream]
Saving to: ‘Centos-7.repo’
100%[============================================================================>] 2,523 --.-K/s in 0s
2019-12-12 16:13:50 (223 MB/s) - ‘Centos-7.repo’ saved [2523/2523]
6.修改$releasever的值
[root@hear yum.repos.d]# ls
Centos-7.repo redhat.repo
[root@hear yum.repos.d]# sed -i 's/$releasever/7/g' /etc/yum.repos.d/Centos-7.repo
[root@hear yum.repos.d]# pwd
/etc/yum.repos.d
[root@hear yum.repos.d]# cat /etc/yum.conf
替换distroverpkg=centos-release
替换成
distroverpkg=redhat-release
[root@hear yum.repos.d]# yum makecache
Loaded plugins: aliases, fastestmirror, langpacks, product-id, protectbase, search-disabled-repos, subscription-
: manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
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
base/x86_64/primary_db FAILED
http://mirrors.cloud.aliyuncs.com/centos/7/os/x86_64/repodata/04efe80d41ea3d94d36294f7107709d1c8f70db11e152d6ef562da344748581a-primary.sqlite.bz2: [Errno 14] curl#6 - "Could not resolve host: mirrors.cloud.aliyuncs.com; Unknown error"
Trying other mirror.
(1/10): base/x86_64/group_gz | 165 kB 00:00:00
(2/10): extras/x86_64/other_db | 100 kB 00:00:00
(3/10): extras/x86_64/filelists_db | 207 kB 00:00:00
(4/10): base/x86_64/other_db | 2.6 MB 00:00:01
(5/10): updates/x86_64/other_db | 356 kB 00:00:00
(6/10): updates/x86_64/filelists_db | 3.3 MB 00:00:01
(7/10): base/x86_64/primary_db | 6.0 MB 00:00:01
base/x86_64/filelists_db FAILED
http://mirrors.aliyuncs.com/centos/7/os/x86_64/repodata/41232548001a78473ae0f2d4b92e1ec28f7a0593e0495056515887fe2a39b416-filelists.sqlite.bz2: [Errno 12] Timeout on http://mirrors.aliyuncs.com/centos/7/os/x86_64/repodata/41232548001a78473ae0f2d4b92e1ec28f7a0593e0495056515887fe2a39b416-filelists.sqlite.bz2: (28, 'Connection timed out after 30002 milliseconds')
Trying other mirror.
extras/x86_64/primary_db FAILED
http://mirrors.aliyuncs.com/centos/7/extras/x86_64/repodata/e87982a7d437db5420d7a3821de1bd4a7b145d57a64a3a464cdeed198c4c1ad5-primary.sqlite.bz2: [Errno 12] Timeout on http://mirrors.aliyuncs.com/centos/7/extras/x86_64/repodata/e87982a7d437db5420d7a3821de1bd4a7b145d57a64a3a464cdeed198c4c1ad5-primary.sqlite.bz2: (28, 'Connection timed out after 30002 milliseconds')
Trying other mirror.
updates/x86_64/primary_db FAILED ] 83 kB/s | 14 MB 00:02:24 ETA
http://mirrors.aliyuncs.com/centos/7/updates/x86_64/repodata/ce9b17323a0afa62b0a6a193c0596365a64f4fee9e0e441736e05a8b11044251-primary.sqlite.bz2: [Errno 12] Timeout on http://mirrors.aliyuncs.com/centos/7/updates/x86_64/repodata/ce9b17323a0afa62b0a6a193c0596365a64f4fee9e0e441736e05a8b11044251-primary.sqlite.bz2: (28, 'Connection timed out after 30001 milliseconds')
Trying other mirror.
(8/10): extras/x86_64/primary_db | 153 kB 00:00:00
(9/10): base/x86_64/filelists_db | 7.3 MB 00:00:01
(10/10): updates/x86_64/primary_db
[root@hear yum.repos.d]# yum repolist all
Loaded plugins: aliases, fastestmirror, langpacks, product-id, protectbase, search-disabled-repos, subscription-
: manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
0 packages excluded due to repository protections
repo id repo name status
base/x86_64 CentOS-7 - Base - mirrors.aliyun.com enabled: 10,097
centosplus/x86_64 CentOS-7 - Plus - mirrors.aliyun.com disabled
contrib/x86_64 CentOS-7 - Contrib - mirrors.aliyun.com disabled
extras/x86_64 CentOS-7 - Extras - mirrors.aliyun.com enabled: 305
updates/x86_64 CentOS-7 - Updates - mirrors.aliyun.com enabled: 972
repolist: 11,374