How to download package on my linux machine ?
In this article, we will see how to download a file/package on a linux machine.
This is very useful as sometimes some commands are not available, or needs some option to be enabled.
1. Using wget command
[user@ngelinux001 saket]$ wget https://us.download.nvidia.com/XFree86/Linux-x86_64/450.80.02/NVIDIA-Linux-x86_64-450.80.02.run --2022-07-11 09:53:04-- https://us.download.nvidia.com/XFree86/Linux-x86_64/450.80.02/NVIDIA-Linux-x86_64-450.80.02.run Resolving us.download.nvidia.com... 192.229.232.112, 2606:2800:247:2063:46e:21d:825:102e Connecting to us.download.nvidia.com|192.229.232.112|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 141055124 (135M) [application/octet-stream] Saving to: “NVIDIA-Linux-x86_64-450.80.02.run” 100%[======================================================================================>] 141,055,124 102M/s in 1.3s 2022-07-11 09:53:07 (102 MB/s) - “NVIDIA-Linux-x86_64-450.80.02.run” saved [141055124/141055124] [user@ngelinux001 saket]$
2. wget command with skip certificate check.
Sometimes we get an error when we connection using https, or trying to establish a secure connection.
To resolve this, we need to use an option “–no-check-certificate” with this command.
[root@server2 ~]# wget https://us.download.nvidia.com/XFree86/Linux-x86_64/450.80.02/NVIDIA-Linux-x86_64-450.80.02.run --2022-03-25 06:48:01-- https://us.download.nvidia.com/XFree86/Linux-x86_64/450.80.02/NVIDIA-Linux-x86_64-450.80.02.run Resolving us.download.nvidia.com (us.download.nvidia.com)... 192.229.211.70, 2606:2800:21f:3aa:dcf:37b:1ed6:1fb Connecting to us.download.nvidia.com (us.download.nvidia.com)|192.229.211.70|:443... connected. Unable to establish SSL connection. [user@ngelinux001 saket]$ wget https://us.download.nvidia.com/XFree86/Linux-x86_64/450.80.02/NVIDIA-Linux-x86_64-450.80.02.run --no-check-certificate --2022-07-11 09:53:56-- https://us.download.nvidia.com/XFree86/Linux-x86_64/450.80.02/NVIDIA-Linux-x86_64-450.80.02.run Resolving us.download.nvidia.com... 192.229.232.112, 2606:2800:247:2063:46e:21d:825:102e Connecting to us.download.nvidia.com|192.229.232.112|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 141055124 (135M) [application/octet-stream] Saving to: “NVIDIA-Linux-x86_64-450.80.02.run.1” 100%[======================================================================================>] 141,055,124 68.9M/s in 2.0s 2022-07-11 09:53:58 (68.9 MB/s) - “NVIDIA-Linux-x86_64-450.80.02.run.1” saved [141055124/141055124] [user@ngelinux001 saket]$
3. Using curl command
[root@server2 bin]# curl -LO "https://us.download.nvidia.com/XFree86/Linux-x86_64/450.80.02/NVIDIA-Linux-x86_64-450.80.02.run"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
curl: (35) TCP connection reset by peer
[root@server2 bin]#
### Check out in verbose mode
[user@ngelinux001 saket]$ curl -v https://us.download.nvidia.com/XFree86/Linux-x86_64/450.80.02/NVIDIA-Linux-x86_64-450.80.02.run
* About to connect() to us.download.nvidia.com port 443 (#0)
* Trying 192.229.232.112... connected
* Connected to us.download.nvidia.com (192.229.232.112) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* CAfile: /etc/pki/tls/certs/ca-bundle.crt
CApath: none
* NSS error -12190
* Closing connection #0
* SSL connect error
curl: (35) SSL connect error
[user@ngelinux001 saket]$
