How to install wget on RHEL/CentOS 6/7/8 using yum

I am trying to download a file using ‘wget http://url’ syntax, but I am getting an error:


bash: wget: command not found

How do I fix this problem? How can I install wget on a CentOS/RHEL version 8, 7 or 6 server using yum command?

GNU Wget is a free and open source software package for retrieving files using HTTP, HTTPS, and FTP, the most widely-used Internet protocols. The GNU/wget might not be installed on your system and here is how to install it using yum command.

How to use yum to install wget command

Open the Terminal application or login using ssh client and type the following yum command to install wget on CentOS/RHEL 7:
$ sudo yum install wget
Sample outputs:

Fig.01: Installing GNU/wget on CentOS/RHEL using yum command

Fig.01: Installing GNU/wget on CentOS/RHEL using yum command

A note about Fedora Linux users

Use the following dnf command to install wget on Fedora 24:
$ sudo dnf install wget

How to install wget on CentOS 7 or RHEL 6

$ sudo yum install wget

Installing wget on CentOS 8 or RHEL 8

Again use the same command:
$ sudo yum install wget
Sample outputs:

Red Hat Update Infrastructure 3 Client Configur 1.9 kB/s | 2.1 kB     00:01    
Red Hat Enterprise Linux 8 for x86_64 - AppStre 5.6 MB/s | 7.7 MB     00:01    
Red Hat Enterprise Linux 8 for x86_64 - BaseOS   16 MB/s | 4.7 MB     00:00    
Dependencies resolved.
 Package  Arch       Version               Repository                      Size
 wget     x86_64     1.19.5-7.el8_0.1      rhel-8-appstream-rhui-rpms     734 k
Transaction Summary
Install  1 Package
Total download size: 734 k
Installed size: 2.8 M
Is this ok [y/N]: y
Downloading Packages:
wget-1.19.5-7.el8_0.1.x86_64.rpm                5.9 MB/s | 734 kB     00:00    
Total                                           5.3 MB/s | 734 kB     00:00     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                        1/1 
  Installing       : wget-1.19.5-7.el8_0.1.x86_64                           1/1 
  Running scriptlet: wget-1.19.5-7.el8_0.1.x86_64                           1/1 
  Verifying        : wget-1.19.5-7.el8_0.1.x86_64                           1/1 

How do I use wget command?

The syntax is:
wget url
wget [options] http://url
wget [options] ftp://url

Usage and examples

To download a file from the internet, enter:
$ wget
Sample outputs:

--2016-11-22 08:45:26--
Resolving (
Connecting to (||:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1022 [text/plain]
Saving to: 'adduser.txt'
100%[======================================>] 1,022       --.-K/s   in 0s      
2016-11-22 08:45:27 (59.4 MB/s) - 'adduser.txt' saved [1022/1022]

To use the wget with proxy authentication, enter:
$ export https_proxy=""
$ wget --proxy-user "USERNameHere" --proxy-password "PASSWORDHere" http://url-here

To use wget with a username and password for FTP / HTTP file retrieval, use:
$ wget --user=NAME --password='PASSWORD' url
To download a large file in size in background, enter:
$ wget -bqc http://path-to-freebsd-mirros-url/freebsd-lastest.iso
You can resume broken download with wget using the following syntax:
$ wget -c http://url/large.file.tar.gz
$ wget --continue https://url/file.iso

Anther usage is to archive a website using wget:
$ wget -nprk 'https://www.some-url-here/'

Creating ~/.wgetrc file

The $HOME/.wgetrc file act as an initialization file for GNU wget. You can store option in it. Here is my sample $HOME/.wgetrc file:

# sample file 
# Try ipv6 addresses first
prefer-family = IPv6
# Setup proxy
https_proxy =
http_proxy =
ftp_proxy =
# Setup the credentials for both http/ftp
See also:
🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallCentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNCentOS 8 Debian 10 Firewall Ubuntu 20.04

1 comment… add one
  • root Nov 22, 2016 @ 9:29

    use curl ;)

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.