You can use the following methods to configure your console to use a proxy server so that console based programs like wget could get connect to the internet through the proxy.
- 1 – Set the environment variable
-
# export http_proxy=http://DOMAIN\USERNAME:PASSWORD@SERVER:PORT/
# export ftp_proxy=http://DOMAIN\USERNAME:PASSWORD@SERVER:PORT/In the above configuration you can ommit the DOMAIN\USERNAME:PASSWORD@ part if you are not using proxy authentication.
Note: If you get the following error when you try to use wget, you might have to pass the proxy authentication credentials to wget as arguments.
-
Connecting to SERVER:PORT... connected.
Proxy request sent, awaiting response... 407 Proxy Authentication Required
11:14:45 ERROR 407: Proxy Authentication Required. - 1.1 – Passing proxy authentication credentials to wget as arguments
-
$ wget --proxy-user "DOMAIN\USERNAME" --proxy-passwd "PASSWORD" URL
-
- 2 – Configure the proxy settings in the .bashrc
- If you want set the proxy for all the users you can do it in the system wide .bashrc file.
#proxy settingsnano /etc/bash.bashrc
export http_proxy=http://DOMAIN\USERNAME:PASSWORD@SERVER:PORT/
export ftp_proxy=http://DOMAIN\USERNAME:PASSWORD@SERVER:PORT/Note: The system wide .bashrc file may not be available in all Linux systems and only can be used if you are using the bash shell
- 2.1 – Having an alias for wget with proxy
- If you don’t want to pass the proxy arguments to wget all the time, you create an alias for wget in the .bashrc file
alias wget 'wget --proxy-user "DOMAIN\USERNAME" --proxy-passwd "PASSWORD"'