无法在AWS EC2 Linux服务器中使用Curl和WGET下载

发布于 2025-02-06 13:43:43 字数 3614 浏览 2 评论 0原文

我正在使用带有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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

思念满溢 2025-02-13 13:43:43

您是否尝试过更新OS并尝试使用WGET命令,而无需这样的-v标志:

wget https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.7.0.2747-linux.zi

您还可以添加- 无检查 - 认证,也可以修改〜/.wgetrc文件并补充说,

check_certificate = off

如果您信任主人,可以做这两件事,希望这对您有所帮助

Have you tried to update the OS and try to use the wget command without the -v flag like this:

wget https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.7.0.2747-linux.zi

you can also add --no-check-certificate or you can modify the ~/.wgetrc file and add

check_certificate = off

You can do this two things if you trust the host, hope this helps

篱下浅笙歌 2025-02-13 13:43:43

我可以知道您是否正在为此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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文