【 Linux学习】Linux环境下利用wget下载https链接内容时报错:无法本地校验颁发者的权限。 要以不安全的方式连接至 ,使用“--no-check-certificate”

版权声明:本文为【欧阳鹏】原创文章,欢迎转载,转载请注明出处! 【http://blog.csdn.net/ouyang_peng】 https://blog.csdn.net/qq446282412/article/details/83151570

一、问题描述

今天在CenterOS系统上使用wget命令下载一个https链接的内容时报错,如下所示:
在这里插入图片描述

[root@localhost /]# wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-9.4.3-ce.0.el7.x86_64.rpm
--2018-10-18 19:16:39--  https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-9.4.3-ce.0.el7.x86_64.rpm
正在解析主机 mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)... 101.6.8.193, 2402:f000:1:408:8100::1
正在连接 mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)|101.6.8.193|:443... 已连接。
错误: 无法验证 mirrors.tuna.tsinghua.edu.cn 的由 “/C=US/ST=VeriSign, Inc./L=VeriSign Trust Network/O=Terms of use at https://www.verisign.com/rpa/OU=Terms of use at https://www.verisign.com/rpa/CN=VeriSign Class 1 Extended Validation CA” 颁发的证书:
  无法本地校验颁发者的权限。
要以不安全的方式连接至 mirrors.tuna.tsinghua.edu.cn,使用“--no-check-certificate”。
[root@localhost /]# 

二、解决办法

从上面的错误提示中,告诉我们

要以不安全的方式连接至 mirrors.tuna.tsinghua.edu.cn,使用“–no-check-certificate”。

因此,我们使用“–no-check-certificate”选项, 以不安全的方式连接,重新运行下命令

在这里插入图片描述

[root@localhost /]# wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-9.4.3-ce.0.el7.x86_64.rpm --no-check-certificate
--2018-10-18 19:18:27--  https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-9.4.3-ce.0.el7.x86_64.rpm
正在解析主机 mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)... 101.6.8.193, 2402:f000:1:408:8100::1
正在连接 mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)|101.6.8.193|:443... 已连接。
警告: 无法验证 mirrors.tuna.tsinghua.edu.cn 的由 “/C=US/ST=VeriSign, Inc./L=VeriSign Trust Network/O=Terms of use at https://www.verisign.com/rpa/OU=Terms of use at https://www.verisign.com/rpa/CN=VeriSign Class 1 Extended Validation CA” 颁发的证书:
  无法本地校验颁发者的权限。
已发出 HTTP 请求,正在等待回应... 302 Moved Temporarily
位置:http://1.1.1.2/ac_portal/needauth.html?vlanid=0&url=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-9.4.3-ce.0.el7.x86_64.rpm [跟随至新的 URL]
--2018-10-18 19:18:28--  http://1.1.1.2/ac_portal/needauth.html?vlanid=0&url=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-9.4.3-ce.0.el7.x86_64.rpm
正在连接 1.1.1.2:80... 已连接。
已发出 HTTP 请求,正在等待回应... 302 Moved Temporarily
位置:http://1.1.1.2:80/ac_portal/proxy.html?template=default&tabs=pwd&vlanid=0&_ID_=0&switch_url=&url=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-9.4.3-ce.0.el7.x86_64.rpm [跟随至新的 URL]
--2018-10-18 19:18:28--  http://1.1.1.2/ac_portal/proxy.html?template=default&tabs=pwd&vlanid=0&_ID_=0&switch_url=&url=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-9.4.3-ce.0.el7.x86_64.rpm
再次使用存在的到 1.1.1.2:80 的连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:2250 (2.2K) [text/html]
正在保存至: “gitlab-ce-9.4.3-ce.0.el7.x86_64.rpm”

100%[===================================================================================================================================================>] 2,250       --.-K/s 用时 0s      

2018-10-18 19:18:28 (524 MB/s) - 已保存 “gitlab-ce-9.4.3-ce.0.el7.x86_64.rpm” [2250/2250])

[root@localhost /]# 

这样就可以以不安全的方式连接HTTPS了。


新的问题,下载的文件大小有问题

虽然这种方式是下载下来了 gitlab-ce-9.4.3-ce.0.el7.x86_64.rpm 但是文件大小有问题,总共才2250个字节,无法安装。

在这里插入图片描述

无法安装
在这里插入图片描述

-rwxrwxrwx. 1 root root 122392350720 10月 18 14:09 1539717714_2018_10_17_9.4.3_gitlab_backup.tar
-rw-r--r--. 1 root root         2250 10月 19 08:45 gitlab-ce-9.4.3-ce.0.el7.x86_64.rpm
[root@localhost backups]# 
[root@localhost backups]# 
[root@localhost backups]# rpm -i gitlab-ce-9.4.3-ce.0.el7.x86_64.rpm
错误:gitlab-ce-9.4.3-ce.0.el7.x86_64.rpm: 不是 rpm 软件包 (或者没有manifest):
[root@localhost backups]# 

解决方法

后来我的解决办法是在windows直接下载该链接下来,大小正常为 339 MB (356,199,584 字节)

在这里插入图片描述

然后通过git bash 客户端,操作scp命令,复制到我的那台linux电脑上。
在这里插入图片描述

在这里插入图片描述

DH207891+OuyangPeng@DH207891 MINGW32 /g/gitlab
$ ll
total 347852
-rw-r--r-- 1 DH207891+OuyangPeng 197609 356199584 10月 18 20:15 gitlab-ce-9.4.3- ce.0.el7.x86_64.rpm

DH207891+OuyangPeng@DH207891 MINGW32 /g/gitlab
$ scp gitlab-ce-9.4.3-ce.0.el7.x86_64.rpm [email protected]:/var/opt/gitlab/ba ckups
[email protected]'s password:
gitlab-ce-9.4.3-ce.0.el7.x86_64.rpm                          30%  104MB  12.0MB/sgitlab-ce-9.4.3-ce.0.el7.x86_64.rpm                      73%  251MB  11.5MB/s   0gitlab-ce-9.4.3-ce.0.el7.x86_64.rpm            100%  340MB  11.3MB/s   00:30

DH207891+OuyangPeng@DH207891 MINGW32 /g/gitlab
$

在这里插入图片描述

这个文件大小就是正确的!


在这里插入图片描述

作者:欧阳鹏 欢迎转载,与人分享是进步的源泉!
转载请保留原文地址:https://blog.csdn.net/ouyang_peng/article/details/83117025
如果觉得本文对您有所帮助,欢迎您扫码下图所示的支付宝和微信支付二维码对本文进行随意打赏。您的支持将鼓励我继续创作


在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq446282412/article/details/83151570