Configure wget to use a proxy server CentOS

Configure wget to use a proxy server CentOS

Configure wget to use a proxy server CentOS

If you have a proxy between you an the internet, this is a common task of making applications work well with the proxy. Here’s one of those that’s extremely useful to have configured.

Login and su to root

Root shell prompt on the nas2 server

first you might want to check and see if there is already an environmental variable for proxy set, this would save a bit of time figuring out the syntax

Root prompt before checking for an existing proxy environment variable

If there is not an environmental variable for proxy set, to test you could temporarily set one by using the following syntax:

Root prompt before setting a temporary http_proxy variable

or the following with a  username/password:

export http_proxy with username:password@proxy.mydomain.com:8080

To make this change permanent, so settings are not lost on reboot, or logout, we need to edit the wget configuration file

vi /etc/wgetrc to set the proxy permanently

you should find the appropriate line around 78 or 79 depending on your configuration

/etc/wgetrc lines 76-80 with the commented https_proxy, http_proxy and ftp_proxy

edit it in a way that will work with your environment

wgetrc line 79 http_proxy set to a proxy with username and password

if you are required to enter a username or password, configure as follows:

wgetrc line 79 http_proxy = http://username:password@proxy.mydomain.com:8080/

if all is configured properly, you should be able to wget a package

That’s it!

Hosted Linux Servers at www.zwiegnet.com/go

Related guides: Configure Squid LDAP Authentication | Load Balance Squid Reverse Proxy

Leave a Reply

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