Wget is an non-interactive down-loader which downloads files from the web. HTTP and FTP protocols being used for downloading the files over internet. However if you don’t have installed wget utility on your system then you may across “bash: wget: command not found” error while execution. This post quickly helps to resolve “bash: wget: command not found” error.
Error description:
You get following error while using wget command:
[root@rhel2 ~]# 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 “bash: wget: command not found”
To resolve “bash: wget: command not found” error you need to install wget utility on the server.
On Debian and Ubuntu:
root@ubuntu:~# apt-get install wget
Sample installation logs:
root@ubuntu:~# 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.
[root@rhel2 ~]# yum install wget
Sample installation logs:
[root@rhel2 ~]# 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! [root@rhel2 ~]#
How to Use wget for downloading files over web.
Syntax:
wget http://url/file or wget ftp://url/file
Sample wget download logs:
[root@rhel2 ~]# wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm --2017-05-01 00:45:45-- 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’ [root@rhel2 ~]# wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-9.noarch.rpm --2017-05-01 00:46:16-- 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-01 00:46:17 (57.8 KB/s) - ‘epel-release-7-9.noarch.rpm’ saved [14704/14704]
In the above example we have downloaded file “rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm” from the url location “packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm” using http protocol.
Leave a Reply