≡ Menu

How to install wget on RHEL/CentOS 7 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 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.

Use yum to install wget

Open the Terminal application or login using ssh client and type the following command to install wget on CentOS/RHEL 5/6/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 syntax to install wget on Fedora 24:
$ sudo dnf install wget

How do I use wget?

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 https://www.cyberciti.biz/files/adduser.txt
Sample outputs:

--2016-11-22 08:45:26--  https://www.cyberciti.biz/files/adduser.txt
Resolving www.cyberciti.biz (www.cyberciti.biz)...
Connecting to www.cyberciti.biz (www.cyberciti.biz)||: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="https://server1.cyberciti.biz:3128/"
$ 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
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://server1.cyberciti.biz:3128/
http_proxy = http://server1.cyberciti.biz:3128/
ftp_proxy = http://server1.cyberciti.biz:3128/
# Setup the credentials for both http/ftp
See also:
Share this tutorial on:

Your support makes a big difference:
I have a small favor to ask. More people are reading the nixCraft. Many of you block advertising which is your right, and advertising revenues are not sufficient to cover my operating costs. So you can see why I need to ask for your help. The nixCraft, takes a lot of my time and hard work to produce. If you use nixCraft, who likes it, helps me with donations:
Become a Supporter →    Make a contribution via Paypal/Bitcoin →   

Don't Miss Any Linux and Unix Tips

Get nixCraft in your inbox. It's free:

{ 1 comment… add one }
  • root November 22, 2016, 9:29 am

    use curl ;)

Leave a Comment

You can use these HTML tags and attributes: <strong> <em> <pre> <code> <a href="" title="">

   Tagged with: , , , , , ,