这几天想在自己的虚拟机上安装nc,遇到了各种各样的问题,上度娘搜了好久,问题基本定位了是因为CentOS6停止更新、支持后yum源的问题,网上的解决办法有好多,基本上都是手动修改文件CentOS-Base.repo,试了网上很多的方法,还是有些问题
遇到的问题一
http://vault.centos.org/6.5/os/x86_64/repodata/repomd.xml: [Errno 14] Peer cert cannot be verified or peer cert invalid
Trying other mirror.
http://vault.centos.org/6.5/os/x86_64/Packages/nc-1.84-24.el6.x86_64.rpm: [Errno 14] Peer cert cannot be verified or peer cert invalid
Trying other mirror.
[root@hadoop01 yum.repos.d]# yum install nc
Loaded plugins: security
http://vault.centos.org/6.5/os/x86_64/repodata/repomd.xml: [Errno 14] Peer cert cannot be verified or peer cert invalid
Trying other mirror.
http://vault.centos.org/6.5/extras/x86_64/repodata/repomd.xml: [Errno 14] Peer cert cannot be verified or peer cert invalid
Trying other mirror.
http://vault.centos.org/6.5/updates/x86_64/repodata/repomd.xml: [Errno 14] Peer cert cannot be verified or peer cert invalid
Trying other mirror.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package nc.x86_64 0:1.84-24.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=================================================================================================================================================================================================
Package Arch Version Repository Size
=================================================================================================================================================================================================
Installing:
nc x86_64 1.84-24.el6 base 57 k
Transaction Summary
=================================================================================================================================================================================================
Install 1 Package(s)
Total download size: 57 k
Installed size: 109 k
Is this ok [y/N]: y
Downloading Packages:
http://vault.centos.org/6.5/os/x86_64/Packages/nc-1.84-24.el6.x86_64.rpm: [Errno 14] Peer cert cannot be verified or peer cert invalid
Trying other mirror.
Error Downloading Packages:
nc-1.84-24.el6.x86_64: failure: Packages/nc-1.84-24.el6.x86_64.rpm from base: [Errno 256] No more mirrors to try.
遇到的问题二:
http://mirrors.aliyun.com/centos-vault/6/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - “The requested URL returned error: 404 Not Found”
http://mirrors.aliyun.com/centos-vault/6/os/x86_64/Packages/nc-1.84-24.el6.x86_64.rpm: [Errno 14] PYCURL ERROR 22 - “The requested URL returned error: 404 Not Found”
Trying other mirror.
[root@hadoop01 yum.repos.d]# yum install nc
Loaded plugins: security
http://mirrors.aliyun.com/centos-vault/6/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
Trying other mirror.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package nc.x86_64 0:1.84-24.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=================================================================================================================================================================================================
Package Arch Version Repository Size
=================================================================================================================================================================================================
Installing:
nc x86_64 1.84-24.el6 base 57 k
Transaction Summary
=================================================================================================================================================================================================
Install 1 Package(s)
Total download size: 57 k
Installed size: 109 k
Is this ok [y/N]: y
Downloading Packages:
http://mirrors.aliyun.com/centos-vault/6/os/x86_64/Packages/nc-1.84-24.el6.x86_64.rpm: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
Trying other mirror.
Error Downloading Packages:
nc-1.84-24.el6.x86_64: failure: Packages/nc-1.84-24.el6.x86_64.rpm from base: [Errno 256] No more mirrors to try.
解决办法
最后终于在一个帖子中发现了简单得解决办法,依次执行以下命令,即可一键更换yum源为CentOS的Vault源
[root@hadoop01 yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://file.kangle.odata.cc/repo/Centos-6.repo
[root@hadoop01 yum.repos.d]# wget -O /etc/yum.repos.d/epel.repo http://file.kangle.odata.cc/repo/epel-6.repo
[root@hadoop01 yum.repos.d]# yum makecache
命令执行效果
[root@hadoop01 yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://file.kangle.odata.cc/repo/Centos-6.repo
--2021-01-03 22:16:47-- http://file.kangle.odata.cc/repo/Centos-6.repo
正在解析主机 file.kangle.odata.cc... 150.242.98.89
正在连接 file.kangle.odata.cc|150.242.98.89|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:3331 (3.3K) [text/plain]
正在保存至: “/etc/yum.repos.d/CentOS-Base.repo”
100%[=======================================================================================================================================================>] 3,331 --.-K/s in 0s
2021-01-03 22:16:49 (385 MB/s) - 已保存 “/etc/yum.repos.d/CentOS-Base.repo” [3331/3331])
[root@hadoop01 yum.repos.d]# wget -O /etc/yum.repos.d/epel.repo http://file.kangle.odata.cc/repo/epel-6.repo
--2021-01-03 22:17:02-- http://file.kangle.odata.cc/repo/epel-6.repo
正在解析主机 file.kangle.odata.cc... 150.242.98.89
正在连接 file.kangle.odata.cc|150.242.98.89|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:1474 (1.4K) [text/plain]
正在保存至: “/etc/yum.repos.d/epel.repo”
100%[=======================================================================================================================================================>] 1,474 --.-K/s in 0s
2021-01-03 22:17:02 (399 MB/s) - 已保存 “/etc/yum.repos.d/epel.repo” [1474/1474])
[root@hadoop01 yum.repos.d]# yum makecache
Loaded plugins: security
base | 3.7 kB 00:00
base/group_gz | 242 kB 00:00
base/filelists_db | 6.4 MB 00:05
base/other_db | 2.8 MB 00:02
epel | 4.7 kB 00:00
epel/group_gz | 74 kB 00:00
epel/filelists_db | 7.9 MB 00:06
epel/updateinfo | 788 kB 00:00
epel/prestodelta | 574 B 00:00
epel/primary_db | 6.1 MB 00:05
epel/other_db | 3.0 MB 00:02
extras | 3.4 kB 00:00
extras/filelists_db | 24 kB 00:00
extras/prestodelta | 2.2 kB 00:00
extras/other_db | 14 kB 00:00
updates | 3.4 kB 00:00
updates/filelists_db | 8.4 MB 00:07
updates/prestodelta | 357 kB 00:00
updates/primary_db | 12 MB 00:10
updates/other_db | 479 kB 00:00
Metadata Cache Created
安装测试
再次进行安装测试后,安装成功
[root@hadoop01 yum.repos.d]# yum install nc
Loaded plugins: security
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package nc.x86_64 0:1.84-24.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=================================================================================================================================================================================================
Package Arch Version Repository Size
=================================================================================================================================================================================================
Installing:
nc x86_64 1.84-24.el6 base 57 k
Transaction Summary
=================================================================================================================================================================================================
Install 1 Package(s)
Total download size: 57 k
Installed size: 109 k
Is this ok [y/N]: y
Downloading Packages:
nc-1.84-24.el6.x86_64.rpm | 57 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : nc-1.84-24.el6.x86_64 1/1
Verifying : nc-1.84-24.el6.x86_64 1/1
Installed:
nc.x86_64 0:1.84-24.el6
Complete!
[root@hadoop01 yum.repos.d]# nc -help
usage: nc [-46DdhklnrStUuvzC] [-i interval] [-p source_port]
[-s source_ip_address] [-T ToS] [-w timeout] [-X proxy_version]
[-x proxy_address[:port]] [hostname] [port[s]]
Command Summary:
-4 Use IPv4
-6 Use IPv6
文章转载自:
http://f.sendong.com/index.php/knowledgebase/86/解决CentOS6停止更新支持后yum源失效.html