Setup HTTP Proxy Settings for Bash Profile on Linux

From Bonus Bits
Jump to: navigation, search

Purpose

This article gives the steps to set HTTP proxy setting for a single user in Bash.


Without Authentication

  1. Edit bash profile
    sudo vim ~/bash_profile
    
  2. Add Proxy Settings
    # Proxy Settings
    export ALL_PROXY=http://proxy.mydomain.com:8080
    export HTTP_PROXY=$ALL_PROXY
    export HTTPS_PROXY=$ALL_PROXY
    export FTP_PROXY=$ALL_PROXY
    export RSYNC_PROXY=$ALL_PROXY
    export http_proxy=$ALL_PROXY
    export https_proxy=$ALL_PROXY
    export ftp_proxy=$ALL_PROXY
    export rsync_proxy=$ALL_PROXY
    export NO_PROXY=.mydomain.com,.local,10.0.2.
    

Icon-Tip-Square-Green.png This will work if all protocols go through say http. Otherwise you'll have to set each one accordingly.


With Authentication

  1. Edit bash profile
    sudo vim ~/bash_profile
    
  2. Add Proxy Settings
    # Proxy Settings
    export ALL_PROXY=http://username:password@proxy.mydomain.com:8080
    export HTTP_PROXY=$ALL_PROXY
    export HTTPS_PROXY=$ALL_PROXY
    export FTP_PROXY=$ALL_PROXY
    export RSYNC_PROXY=$ALL_PROXY
    export http_proxy=$ALL_PROXY
    export https_proxy=$ALL_PROXY
    export ftp_proxy=$ALL_PROXY
    export rsync_proxy=$ALL_PROXY
    export NO_PROXY=.mydomain.com,.local,10.0.2.
    


Sources

http://www.centos.org/docs/5/html/yum/sn-yum-proxy-server.html