In this tutorial, we will show you how to install and configuration wget
command on CentOS. For those of you who didn’t know, Wget is a free network utility to download files from the Web using HTTP and FTP, the two most widely used Internet protocols. The wget utility is available for free and licensed under GNU GPL License. However, it also supports HTTPS protocol as well as retrieval through HTTP proxies.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you the step-by-step installation wget on a CentOS server.
Prerequisites
- A server running one of the following operating systems: CentOS or RHEL-based.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- An active internet connection.
- SSH access to the server (or just open Terminal if you’re on a desktop).
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Install Wget on CentOS Linux
Step 1. First, let’s start by ensuring your system is up-to-date.
sudo dnf update
Step 2. Installing wget on CentOS Linux.
To install the wget
command on a CentOS machine just run the command:
sudo dnf install wget
Example wget command
To download a single file from a website use the following command:
wget http://sitename.com/file.jpg
If your web page requires a username and password use the following command:
wget --user=youruser --password=yourpassword http://sitename.com/file.jpeg
Download a file from an FTP site using the following command:
wget ftp://sitename.com/file.jpeg
If your FTP site requires a username and password use the following command:
wget ---ftp-user=youruser --ftp-password=yourpassword ftp://sitename.com/file.jpeg
Download an entire website using the following command:
wget -r http://sitename.com
Download and save it in a specific path using the following command:
wget --directory-prefix=folder/nextfolder sitename.com
Download a file and save it under a different name using the following command:
wget --output-document=filename.php sitename.com
Resume an interrupted file download using the following command:
wget --continue sitename.com/filename.mp4
Limit the download speed of a file using the following command:
wget --limit-rate=1000k http://sitename.com/file.iso
Congratulation’s! You have successfully installed wget. Thanks for using this tutorial for installing wget command on your CentOS system. For additional help or useful information, we recommend you to check the official wget website.