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

一、问题描述

今天在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 /]# 

二、解决办法

2.1 无效方法

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

要以不安全的方式连接至 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了。


2.2 曲线救国之法

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

虽然这种方式是下载下来了 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]# 

2.2.2 解决方法

后来我的解决办法是在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 root@172.28.180.116:/var/opt/gitlab/ba ckups
root@172.28.180.116'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
$

在这里插入图片描述

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


三、关于GNU Wget 介绍

最初,wget在某些发行版本中不支持https下载。我们需要使用openssl手动编译源代码。之后,我们可以进行https下载

Sometimes the precompiled wget binaries refuse to work with your ssl linked libraries.
The simple solution is to compile a new wget binary to be used with your ssl libraries.

wget http://files.directadmin.com/services/wget-1.8.2.tar.gz  
 tar xvzf wget-1.8.2.tar.gz  
 cd wget-1.8.2  
 ./configure **--prefix=/usr** --with-ssl  
 make  
 make install

If you’re using FreeBSD, you’d need to use –prefix=/usr/local instead of /usr.
Obviously, if you don’t have wget to begin with, you’d need to use another tool to download the wget source code, like “fetch” or “lynx”.



在这里插入图片描述

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


在这里插入图片描述

  • 4
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

字节卷动

你的鼓励将是我创作的最大动力!

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值