无法在AWS EC2 Linux服务器中使用Curl和WGET下载
我正在使用带有Putty的EC2服务器。
我想将最新的Sonar-Scanner下载到EC2服务器上。
我尝试使用WGET&卷曲,但他们一直在相同的消息中失败。
这是我使用的服务器系统: Red Hat Enterprise Linux Server 7.8(Maipo)
- WGET
GNU Wget 1.14 built on linux-gnu.
[root@ip-10-X-X-X ~]# wget -v https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.7.0.2747-linux.zip
--2022-06-09 09:56:55-- https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.7.0.2747-linux.zip
Resolving binaries.sonarsource.com (binaries.sonarsource.com)... 99.84.191.23, 99.84.191.71, 99.84.191.75, ...
Connecting to binaries.sonarsource.com (binaries.sonarsource.com)|99.84.191.23|:443... connected.
Unable to establish SSL connection.
- curl
curl 7.29.0 (x86_64-redhat-linux-gnu) libcurl/7.29.0 NSS/3.44 zlib/1.2.7 libidn/1.28 libssh2/1.8.0
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smtp smtps telnet tftp
Features: AsynchDNS GSS-Negotiate IDN IPv6 Largefile NTLM NTLM_WB SSL libz unix-sockets
[root@ip-10-X-X-X ~]# curl -O -v https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.7.0.2747-linux.zip
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* About to connect() to binaries.sonarsource.com port 443 (#0)
* Trying 99.84.208.28...
* Connected to binaries.sonarsource.com (99.84.208.28) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* CAfile: /etc/pki/tls/certs/ca-bundle.crt
CApath: none
0 0 0 0 0 0 0 0 --:--:-- 0:00:29 --:--:-- 0* NSS error -5938 (PR_END_OF_FILE_ERROR)
* Encountered end of file
0 0 0 0 0 0 0 0 --:--:-- 0:00:30 --:--:-- 0
* Closing connection 0
curl: (35) Encountered end of file
我是新来的EC2服务器。您知道我该怎么办?
谢谢,任何帮助都将不胜感激!
更新:
- 我添加了
-K
和- 无检查 - 认证
分别为curl& wget,但仍返回相同的错误消息, - 我尝试检查WGET连接,但它似乎对URL不起作用的下载端点:
[root@ip-10-70-10-87 settings]# wget -q --spider https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.7.0.2747-linux.zip
[root@ip-10-70-10-87 settings]# echo $?
4
[root@ip-10-70-10-87 settings]# wget -q --spider https://www.google.com/
[root@ip-10-70-10-87 settings]# echo $?
0
[root@ip-10-70-10-87 settings]# wget -q --spider https://dlcdn.apache.org/maven/maven-3/3.8.6/binaries/apache-maven-3.8.6-bin.tar.gz
[root@ip-10-70-10-87 settings]# echo $?
4
[root@ip-10-70-10-87 settings]# wget -q --spider https://assets.ctfassets.net/br4ichkdqihc/6jNPyoUDznu06Mk4dr9CEn/560e34fec221fad43a501442a551ad92/SimpliSafe_Outdoor_Battery_Camera_Open_Source_Disclosures_Launch.DOCX
[root@ip-10-70-10-87 settings]# echo $?
4
[root@ip-10-70-10-87 settings]# wget -q --spider https://twitter.com/home
[root@ip-10-70-10-87 settings]# echo $?
0
- 我检查了
I am using the EC2 server with Putty.
I want to download the latest sonar-scanner to the EC2 server.
I tried to access the download-URL using both Wget & Curl but they kept failing with the same messages.
This is the server system I use: Red Hat Enterprise Linux Server 7.8 (Maipo)
- WGET
GNU Wget 1.14 built on linux-gnu.
[root@ip-10-X-X-X ~]# wget -v https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.7.0.2747-linux.zip
--2022-06-09 09:56:55-- https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.7.0.2747-linux.zip
Resolving binaries.sonarsource.com (binaries.sonarsource.com)... 99.84.191.23, 99.84.191.71, 99.84.191.75, ...
Connecting to binaries.sonarsource.com (binaries.sonarsource.com)|99.84.191.23|:443... connected.
Unable to establish SSL connection.
- CURL
curl 7.29.0 (x86_64-redhat-linux-gnu) libcurl/7.29.0 NSS/3.44 zlib/1.2.7 libidn/1.28 libssh2/1.8.0
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smtp smtps telnet tftp
Features: AsynchDNS GSS-Negotiate IDN IPv6 Largefile NTLM NTLM_WB SSL libz unix-sockets
[root@ip-10-X-X-X ~]# curl -O -v https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.7.0.2747-linux.zip
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* About to connect() to binaries.sonarsource.com port 443 (#0)
* Trying 99.84.208.28...
* Connected to binaries.sonarsource.com (99.84.208.28) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* CAfile: /etc/pki/tls/certs/ca-bundle.crt
CApath: none
0 0 0 0 0 0 0 0 --:--:-- 0:00:29 --:--:-- 0* NSS error -5938 (PR_END_OF_FILE_ERROR)
* Encountered end of file
0 0 0 0 0 0 0 0 --:--:-- 0:00:30 --:--:-- 0
* Closing connection 0
curl: (35) Encountered end of file
I'm new with using this EC2 server. Do you know what could I do to solve this?
Thank you, any help would be really appreciated!
UPDATE:
- I added
-k
and--no-check-certificate
to respectively curl & wget, but still returning the same error messages - I tried to check the wget connection, but it doesn't seem to work for URLs with download end-point:
[root@ip-10-70-10-87 settings]# wget -q --spider https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.7.0.2747-linux.zip
[root@ip-10-70-10-87 settings]# echo $?
4
[root@ip-10-70-10-87 settings]# wget -q --spider https://www.google.com/
[root@ip-10-70-10-87 settings]# echo $?
0
[root@ip-10-70-10-87 settings]# wget -q --spider https://dlcdn.apache.org/maven/maven-3/3.8.6/binaries/apache-maven-3.8.6-bin.tar.gz
[root@ip-10-70-10-87 settings]# echo $?
4
[root@ip-10-70-10-87 settings]# wget -q --spider https://assets.ctfassets.net/br4ichkdqihc/6jNPyoUDznu06Mk4dr9CEn/560e34fec221fad43a501442a551ad92/SimpliSafe_Outdoor_Battery_Camera_Open_Source_Disclosures_Launch.DOCX
[root@ip-10-70-10-87 settings]# echo $?
4
[root@ip-10-70-10-87 settings]# wget -q --spider https://twitter.com/home
[root@ip-10-70-10-87 settings]# echo $?
0
- I checked the availability of proxy following this answer (i.e.
env | grep -i proxy
), and nothing came up as response, so I assume I've got no proxy configured
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否尝试过更新OS并尝试使用WGET命令,而无需这样的-v标志:
您还可以添加
- 无检查 - 认证
,也可以修改〜/.wgetrc文件并补充说,如果您信任主人,可以做这两件事,希望这对您有所帮助
Have you tried to update the OS and try to use the wget command without the -v flag like this:
you can also add
--no-check-certificate
or you can modify the ~/.wgetrc file and addYou can do this two things if you trust the host, hope this helps
我可以知道您是否正在为此EC2使用任何代理?如果是,您可以尝试使用
- no-proxy
选项执行WGET命令。在此处找到了类似的问题,可以在答案中提到的TLS版本的兼容性检查:无法在Ubuntu上的WGET上建立SSL连接14.04 LTS
May I know if you are using any proxies for this ec2? If yes could you try to execute the wget command with
--no-proxy
option.Found a similar issue in here, perhap its good to check for tls version compatibility as mentioned in the answers: Unable to establish SSL connection upon wget on Ubuntu 14.04 LTS