How to configure Proxy Settings for the Linux Console and APT
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.
nano /etc/bash.bashrc
#proxy settings
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"'
Additionally if you want APT to use a proxy server you can configure it in the /etc/apt/apt.conf configuration file.
nano /etc/apt/apt.conf
#
# Proxy configuration
#
Acquire::http::Proxy "http://DOMAIN\USERNAME:PASSWORD@SERVER:PORT";- Uditha Atukorala's blog
- Login to post comments
- 33859 reads
-

Recent blog posts
- HTTP chunked transfer-coded data read / decode example in C++
- Why is Testing Necessary
- FormCheck with MooTools v1.3
- Research methodology and methods
- Resource Event Agent (REA) - Pattern Maps
- SAP R/3 and SAP Visual Composer
- Discuss recent advances in broadband wireless technology
- Restricting and Sorting Data
- Current academic activities that use ontologies in a business environment
- Data Warehousing - Data Quality (Issues & Remedies)

Recent comments
2 years 44 weeks ago
2 years 46 weeks ago
3 years 4 weeks ago
3 years 20 weeks ago
3 years 20 weeks ago
3 years 21 weeks ago
3 years 21 weeks ago
3 years 42 weeks ago
4 years 24 weeks ago