Centos wget使用的问题

遇到的问题:

[root@localhost src]# wget -c https://dl.google.com/go/go1.9.6.linux-amd64.tar.gz
--2018-05-04 02:42:54--  https://dl.google.com/go/go1.9.6.linux-amd64.tar.gz
Resolving dl.gocn.io... 120.132.12.8
Connecting to dl.gocn.io|120.132.12.8|:443... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://golang.google.cn/dl [following]
--2018-05-04 02:42:54--  https://golang.google.cn/dl
Resolving golang.google.cn... 203.208.43.87, 203.208.43.88, 203.208.43.79, ...
Connecting to golang.google.cn|203.208.43.87|:443... connected.
ERROR: certificate common name “google.com” doesn’t match requested host name “golang.google.cn”.
To connect to golang.google.cn insecurely, use ‘--no-check-certificate’.

[root@localhost src]#  

问题解决方式:

the ceritificate problem when i use wget a file from java webside

reason is 

wget before 1.12.1 do not support the Server Alternative Names extension

wget  --version //check the version

so just update the wget

yum update wget

总结,执行:yum update wget

[root@localhost src]# yum update wget
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * atomic: mirrors.neusoft.edu.cn
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.163.com
atomic                                                                                                | 3.4 kB     00:00
base                                                                                                  | 3.7 kB     00:00
extras                                                                                                | 3.4 kB     00:00
updates                                                                                               | 3.4 kB     00:00
Setting up Update Process
Resolving Dependencies
--> Running transaction check
---> Package wget.x86_64 0:1.12-1.8.el6 will be updated
---> Package wget.x86_64 0:1.12-10.el6 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

===========================================================================================================================
 Package                    Arch                        Version                            Repository                  Size
===========================================================================================================================
Updating:
 wget                       x86_64                      1.12-10.el6                        base                       484 k

Transaction Summary
===========================================================================================================================
Upgrade       1 Package(s)

Total download size: 484 k
Is this ok [y/N]: y
Downloading Packages:
wget-1.12-10.el6.x86_64.rpm                                                                           | 484 kB     00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating   : wget-1.12-10.el6.x86_64                                                                                  1/2
  Cleanup    : wget-1.12-1.8.el6.x86_64                                                                                 2/2
  Verifying  : wget-1.12-10.el6.x86_64                                                                                  1/2
  Verifying  : wget-1.12-1.8.el6.x86_64                                                                                 2/2

Updated:
  wget.x86_64 0:1.12-10.el6

Complete!
[root@localhost src]#
[root@localhost src]#  

执行结果:

[root@localhost src]# wget -c https://dl.google.com/go/go1.9.6.linux-amd64.tar.gz
--2018-05-04 03:31:20--  https://dl.google.com/go/go1.9.6.linux-amd64.tar.gz
Resolving dl.google.com... 203.208.50.69, 203.208.50.78, 203.208.50.64, ...
Connecting to dl.google.com|203.208.50.69|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 118279574 (113M) [application/octet-stream]
Saving to: “go1.9.6.linux-amd64.tar.gz”


100%[===================================================================================>] 118,279,574 10.4M/s   in 10s


2018-05-04 03:31:33 (10.8 MB/s) - “go1.9.6.linux-amd64.tar.gz” saved [118279574/118279574]


[root@localhost src]# ls
go1.9.6.linux-amd64.tar.gz
[root@localhost src]# ll
total 115508
-rw-r--r--. 1 root root 118279574 May  1 09:48 go1.9.6.linux-amd64.tar.gz
[root@localhost src]#   


也可以使用帮助文件提供的信息:

HTTPS (SSL/TLS) options:
       --secure-protocol=PR     choose secure protocol, one of auto, SSLv2,
                                SSLv3, and TLSv1.
       --no-check-certificate   don’t validate the server’s certificate.[不要验证服务器的证书]
       --certificate=FILE       client certificate file.
       --certificate-type=TYPE  client certificate type, PEM or DER.
       --private-key=FILE       private key file.
       --private-key-type=TYPE  private key type, PEM or DER.
       --ca-certificate=FILE    file with the bundle of CA’s.
       --ca-directory=DIR       directory where hash list of CA’s is stored.
       --random-file=FILE       file with random data for seeding the SSL PRNG.
       --egd-file=FILE          file naming the EGD socket with random data.


直接使用:sudo wget --no-check-certificate https://*****来获取文件;


参考文章:https://blog.csdn.net/shixha/article/details/20731373

猜你喜欢

转载自blog.csdn.net/lottery120/article/details/80190749
今日推荐