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. Wget utility is available for free and licensed is under GNU GPL License. However, it’s 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 through the step by step installation wget on a CentOS server.
Install Wget on CentOS
Step 1. First let’s start by ensuring your system is up-to-date.
yum -y update
Step 2. Installing wget.
To install the wget command on a CentOS machine just run the command:
yum install wget
Example wget command
To download a single file from a website using the following command:
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:
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 and 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 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 web site.