Linux

How To Use Wget using Proxy Server

Wget is a free software package for retrieving files using HTTP, HTTPS, FTP and FTPS, the most widely used Internet protocols. It is a non-interactive commandline tool, so it may easily be called from scripts, cron jobs, terminals without X-Windows support, etc.

Sometimes we need wget to use proxy, for example if you behind firewall or using proxy on your office or school.

There are many ways to use wget using proxy such as using wget command without change configuration, create / edit configuration in $HOME/.wgetrc (~/.wgetrc) or /etc/.wgetrc, and export proxy configuration globally for all application.

Using Wget Command without change configuration

# wget https://ifconfig.me -e use_proxy=yes -e http_proxy=127.0.0.1:8080

Example:

# wget https://ifconfig.me -e use_proxy=yes -e http_proxy=178.128.xxx.xxx:8080
Wget Command Using Proxy

Create / edit configuration in $HOME/.wgetrc (~/.wgetrc) or /etc/.wgetrc

If you create on ~/.wgetrc it’s only available on your profile and if edit on /etc/.wgetrc, ot’s will available globally. So it;s depend on your choices.

# vi ~/.wgetrc

Paste code below

http_proxy = http://[proxy_address]:[proxy_port]
https_proxy = http://[proxy_address]:[proxy_port]
ftp_proxy = http://[proxy_address]:[proxy_port]

Example:

http_proxy = http://178.128.xxx.xxx:8080
https_proxy = http://178.128.xxx.xxx:8080
ftp_proxy = http://178.128.xxx.xxx:8080

Export proxy configuratioinglobally for all application

This configuration is available for all application such as homebrew.

export http_proxy=[proxy_address]:[proxy_port]
export https_proxy=$http_proxy
export ftp_proxy=$http_proxy
export dns_proxy=$http_proxy
export rsync_proxy=$http_proxy
export no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com"

Recent Posts

How to fix yum update error thread.error: can’t start new thread

If you found error thread.error: can't start new thread on yum update command on CentOS…

5 months ago

How to securing Cockpit login with Google Two Factor Authenticator 2FA

Cockpit is a web-based graphical interface for servers, intended for everyone, especially those who are:…

8 months ago

How to install Cockpit on CentOS 7 / CentOS 9 Stream and configure Nginx reserve proxy

From cockpit-project.org, Cockpit is a web-based graphical interface for servers, intended for everyone, especially those…

10 months ago

How to install and configure Nginx with HTTP3 on CentOS 9 Stream / RHEL 9

We have been using Nginx with HTTP3 for more than 1 year on our production…

11 months ago

How to sync date time using Crony on CentOS 9 Stream / RHEL 9

On CentOS 7, to sync date time we often use NTPD. But on CentOS 9,…

11 months ago

How to install and enable REMI repository on CentOS 9 Stream

Remi repository is one of third-party repository that have latest update of PHP on Enterprise…

11 months ago