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 such as 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 installaiton we will show you some real-life wget commands with examples. Installing wget can be done in both ways: from the official repository OR builded from source.
The installation process of wget is straightforward, which may take different lengths depending on how we are using it. Let’s get Wget installed!
Prerequisites
- A server running Ubuntu 26.04 OS
- User privileges: root or non-root user with sudo privileges
Update the System
Before we start with the installation of wget, we assume that you have a freshly installed Ubuntu 26.04 OS, which is why we will update the system packages to their latest versions. To do that execute 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 exexute 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 provides specific advantages over using pre-compiled packages, primarily relating 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 enter it into the wget directory:
tar xvf wget2-latest.tar.gz cd wget2-2.2.1/
Configure and compile the source code by executing the following commands one-by-one:
./configure make
Install the compiled wget executable:
make install
Once the process is completed, we need to make 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 Copyright (C) 2012-2015 Tim Ruehsen Copyright (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 used wget commands with real examples 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 detatils you can execute the following command:
man wget
The output is huge, and this is some 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 . . . . . . .
That’s it. You 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 about installing wget on Ubuntu 26.04, please share it with your friends or leave a comment down below.