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

last updated in Categories , , , , ,

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:


Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

Start the discussion at

Historical Comment Archive