How to solve the error “bash: wget: command not found”

Wget is a non-interactive downloader that downloads files from the Internet. The HTTP and FTP protocols are used to download files over the Internet. However, if you have not installed the wget utility on your system, then you may receive a “bash: wget: command not found” error at runtime. This article will quickly help you resolve the “bash: wget: command not found” error.

Error description:

You will receive the following error message when using the wget command:

[[email protected] ~]# wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
-bash: wget: command not found

How to resolve the “bash: wget: command not found” error

In order to resolve the “bash: wget: command not found” error, you need to install the wget utility on the server.

On Debian and Ubuntu:

[email protected]:~# apt-get install wget

Example installation log:

[email protected]:~# apt-get install wget
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  wget
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 298 kB of archives.
After this operation, 901 kB of additional disk space will be used.
Get:1 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu xenial-updates/main amd64                                                                                         
wget amd64 1.17.1-1ubuntu1.2 [298 kB]
Fetched 298 kB in 0s (401 kB/s)
Selecting previously unselected package wget.
(Reading database ... 51222 files and directories currently installed.)
Preparing to unpack .../wget_1.17.1-1ubuntu1.2_amd64.deb ...
Unpacking wget (1.17.1-1ubuntu1.2) ...
Processing triggers for install-info (6.1.0.dfsg.1-5) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up wget (1.17.1-1ubuntu1.2) ...

On RHEL and Centos.

[[email protected] ~]# yum install wget

Example installation log:

[[email protected] ~]# yum install wget
Loaded plugins: amazon-id, rhui-lb, search-disabled-repos
Resolving Dependencies
--> Running transaction check
---> Package wget.x86_64 0:1.14-13.el7 will be installed
--> Finished Dependency Resolution
 
Dependencies Resolved
 
========================================================================================================================================================================
Package                        Arch                             Version                               Repository                                                  Size
========================================================================================================================================================================
Installing:
wget                           x86_64                           1.14-13.el7                           rhui-REGION-rhel-server-releases                           546 k
 
Transaction Summary
========================================================================================================================================================================
Install  1 Package
 
Total download size: 546 k
Installed size: 2.0 M
Is this ok [y/d/N]: y
Downloading packages:
wget-1.14-13.el7.x86_64.rpm                                                                                                                      | 546 kB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : wget-1.14-13.el7.x86_64                                                                                                                              1/1
  Verifying  : wget-1.14-13.el7.x86_64                                                                                                                              1/1
 
Installed:
  wget.x86_64 0:1.14-13.el7
 
Complete!
[[email protected] ~]#

How to use wget to download files over the Internet.

Syntax:

wget http://url/file
 
or
 
wget ftp://url/file

Load log examples:

[[email protected] ~]# wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
--2017-05-06 11:21:34--  http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
Resolving packages.sw.be (packages.sw.be)... failed: Name or service not known.
wget: unable to resolve host address ‘packages.sw.be’
[[email protected] ~]# wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-9.noarch.rpm
--2017-05-06 11:21:34--  http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-9.noarch.rpm
Resolving dl.fedoraproject.org (dl.fedoraproject.org)... 209.132.181.24, 209.132.181.25, 209.132.181.23
Connecting to dl.fedoraproject.org (dl.fedoraproject.org)|209.132.181.24|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 14704 (14K) [application/x-rpm]
Saving to: ‘epel-release-7-9.noarch.rpm’
 
100%[==============================================================================================================================>] 14,704      57.8KB/s   in 0.2s
 
2017-05-06 11:21:34 (57.8 KB/s) - ‘epel-release-7-9.noarch.rpm’ saved [14704/14704]

In the above example, we downloaded the file “rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm” from the URL “packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2. el6.rf.x86_64.rpm ”using the HTTP protocol.

Sidebar