1. 程式人生 > >【 Linux學習】Linux環境下利用wget下載https連結內容時報錯:無法本地校驗頒發者的許可權。 要以不安全的方式連線至 ,使用“--no-check-certificate”

【 Linux學習】Linux環境下利用wget下載https連結內容時報錯:無法本地校驗頒發者的許可權。 要以不安全的方式連線至 ,使用“--no-check-certificate”

一、問題描述

今天在CenterOS系統上使用wget命令下載一個https連結的內容時報錯,如下所示:
在這裡插入圖片描述

[[email protected] /]# 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”。
[
[email protected]
/]#

二、解決辦法

從上面的錯誤提示中,告訴我們

因此,我們使用“–no-check-certificate”選項, 以不安全的方式連線,重新執行下命令

在這裡插入圖片描述

[[email protected] /]# 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])

[
[email protected]
/]#

這樣就可以以不安全的方式連線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
[
[email protected]
backups]# [[email protected] backups]# [[email protected] 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): [[email protected] backups]#

解決方法

後來我的解決辦法是在windows直接下載該連結下來,大小正常為 339 MB (356,199,584 位元組)

在這裡插入圖片描述

然後通過git bash 客戶端,操作scp命令,複製到我的那臺linux電腦上。
在這裡插入圖片描述

在這裡插入圖片描述

[email protected] 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

[email protected] 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

[email protected] MINGW32 /g/gitlab
$

在這裡插入圖片描述

這個檔案大小就是正確的!

在這裡插入圖片描述

作者:歐陽鵬 歡迎轉載,與人分享是進步的源泉!
轉載請保留原文地址:https://blog.csdn.net/ouyang_peng/article/details/83117025
如果覺得本文對您有所幫助,歡迎您掃碼下圖所示的支付寶和微信支付二維碼對本文進行隨意打賞。您的支援將鼓勵我繼續創作

在這裡插入圖片描述