How to Install Wget on Ubuntu 26.04

[keyword]


In this blog post, we will show you how to install Wget on Ubuntu 26.04 OS. Wget is a command line utility for downloading files from the Internet. It supports various protocols like HTTP, HTTPS, FTP and FTPS. Wget offers a variety of features such as non-interactive downloads, resumable downloads, recursive retrieval, background operations, system integration, etc. In this post, besides the installation, we will show you some real wget commands with examples. Installing wget can be done in both ways: from the official repository OR from the source build.

The installation process of wget is simple, which can take different lengths depending on how we use it. Let’s get Wget installed!

Prerequisites

Update the system

Before we start installing wget, we assume that you have a freshly installed Ubuntu 26.04 operating system, so we will update the system packages to their latest versions. To do this, run the following command:

apt update -y && apt upgrade -y

Install Wget from the repository

Installing wget from a repository ensures proper system integration, automatic dependency management, and a secure, standardized installation process. To install wget from the official Ubuntu 26.04 repository, run the following command:

apt install wget -y

To verify the installation, check the installed wget version with the following command:

wget --version

The output is huge, and this is one part of it:

(email protected):~# wget --version
GNU Wget 1.25.0 built on linux-gnu.

-cares +digest -gpgme +https +ipv6 +iri +large-file -metalink +nls 
+ntlm +opie +psl +ssl/gnutls 

Wgetrc: 
    /etc/wgetrc (system)
Locale: 
    /usr/share/locale 
Compile: 
        .
        .
        .
        .

Install wget from Source

Installing Wget from source code offers specific advantages over using precompiled packages, mainly related to customization, compatibility, and access to the absolute latest features or bug fixes.

Before we can download the wget installation packages, we need to install some prerequisites:

apt update && apt install build-essential libssl-dev zlib1g-dev -y

Next is to download the source code:

curl -O https://ftp.gnu.org/gnu/wget/wget2-latest.tar.gz

Once downloaded, extract the file and import it into the wget directory:

tar xvf wget2-latest.tar.gz

cd wget2-2.2.1/

Configure and compile the source code by running the following commands one by one:

./configure

make

Install the compiled wget executable:

make install

Once the process is complete, we need to create a symbolic link:

ln -s /usr/local/bin/wget2 /usr/bin/wget

To check the installed wget version:

wget -V

You should get the following output:

(email protected):~/wget2-2.2.1# wget -V
GNU Wget2 2.2.1 - multithreaded metalink/file/website downloader

+digest +https +ssl/gnutls +ipv6 +iri +large-file +nls -ntlm -opie +psl -hsts
+iconv +idn2 +zlib -lzma +brotlidec +zstd -bzip2 -lzip +http2 -gpgme

 (C) 2012-2015 Tim Ruehsen
 (C) 2015-2024 Free Software Foundation, Inc.

License GPLv3+: GNU GPL version 3 or later
.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Please send bug reports and questions to .

Wget commands

This is a list of the most commonly used wget commands with real examples that you can run in a terminal:

1. Download a single file - Downloads a file from a URL and saves it to the current directory.

wget https://example.com/file.zip

2. Download and save with a different name - Saves the download under a custom filename (myfile.zip).

wget -O myfile.zip https://example.com/file.zip

3. Resume a partially downloaded file - Continues downloading where it was interrupted (if supported by the server).

wget -c https://example.com/largefile.iso

4. Download multiple files from a list - Reads URLs from a text file (urls.txt) and downloads each one.

wget -i urls.txt

5. Save downloaded files into a specific directory - Saves the file into the ~/Downloads folder instead of the current directory.

wget -P ~/Downloads https://example.com/report.pdf

6. Download in the background - Runs the download in the background so you can keep using your terminal.

wget -b https://example.com/hugearchive.tar.gz

More about Wget

If you want to learn more about the wget command in detail, you can run the following command:

man wget

The output is huge, and this is part of it:

(email protected):~# man wget
WGET(1)                                                                                 GNU Wget                                                                                WGET(1)

NAME
       Wget - The non-interactive network downloader.

SYNOPSIS
       wget (option)... (URL)...

DESCRIPTION
       GNU Wget is a free utility for non-interactive download of files from the Web.  It supports HTTP, HTTPS, and FTP protocols, as well as retrieval through HTTP proxies.

       Wget is non-interactive, meaning that it can work in the background, while the user is not logged on.  This allows you to start a retrieval and disconnect from the system,
       letting Wget finish the work.  By contrast, most of the Web browsers require constant user's presence, which can be a great hindrance when transferring a lot of data.

       Wget can follow links in HTML, XHTML, and CSS pages, to create local versions of remote web sites, fully recreating the directory structure of the original site.  This is
       sometimes referred to as "recursive downloading."  While doing that, Wget respects the Robot Exclusion Standard (/robots.txt).  Wget can be instructed to convert the links in
       downloaded files to point at the local files, for offline viewing.

       Wget has been designed for robustness over slow or unstable network connections; if a download fails due to a network problem, it will keep retrying until the whole file has
       been retrieved.  If the server supports regetting, it will instruct the server to continue the download from where it left off.

OPTIONS
   Option Syntax
       Since Wget uses GNU getopt to process command-line arguments, every option has a long form along with the short one.  Long options are more convenient to remember, but take
       time to type.  You may freely mix different option styles, or specify options after the command-line arguments.  Thus you may write:

               wget -r --tries=10 http://fly.srk.fer.hr/ -o log
                   .
                   .
                   .
                   .
                   .
                   .
                   .

This is it. You have successfully installed wget on Ubuntu 26.04 OS. This blog post covered two different methods for installing wget and the most commonly used wget commands.

If you liked this post on installing wget on Ubuntu 26.04, please share it with your friends or leave a comment below.



Eva Grace

Eva Grace

Leave a Reply

Your email address will not be published. Required fields are marked *