Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
155 lines (102 sloc) 3.78 KB

Title: Proxy Cheat Sheet Category: Sys Admin Date: 2016-12-20

CLICK HERE TO VIEW/CONTRIBUTE TO LATEST COPY

#Proxy Cheat Sheet All my VMs at work are behind a proxy so I end up having to set up proxy for many applications. Saw this as a perfect oportunity to build the ultimate "Proxy cheat sheet". I will continue to update this page to add more products.

###Legend

  • <username> = Proxy Username eg: siva
  • <password> = Proxy Password eg: foobar
  • <proxy> = Proxy hostname / address eg: proxy.siv.io or 172.16.8.12
  • <port> = Proxy port eg: 3128

##Apt-get

Add the following line:

Acquire::http::Proxy "http://<username>:<password>@<proxy>:<port>";

to apt.conf usually found in /etc/apt/apt.conf (if this file does not exist, you can create it) ####for example

# vim /etc/apt/apt.conf
Acquire::http::Proxy "http://siva:foobar@1.2.3.4:3128";

##Bash

Add the following lines:

export http_proxy=http://<username>:<password>@<proxy>:<port>
export https_proxy=https://<username>:<password>@<proxy>:<port>
export ftp_proxy=ftp://<username>:<password>@<proxy>:<port>

to your .bashrc or .bash_profile file

####for example

# vim ~/.bashrc
export http_proxy=http://siva:foobar@1.2.3.4:3128
export https_proxy=https://siva:foobar@1.2.3.4:3128
# source ~/.bashrc

##Git (Linux)

Run the following command:

git config --global http.proxy http://<username>:<password>@<proxy>:<port>

####for example

git config --global http.proxy http://siva:foobar@1.2.3.4:3128

##Maven

Add the following lines:

<settings>
  <proxies>
   <proxy>
      <id>example-proxy</id>
      <active>true</active>
      <protocol>http</protocol>
      <host><proxy></host>
      <port><port></port>
      <username><username></username>
      <password><password></password>
      <nonProxyHosts>www.google.com|*.example.com</nonProxyHosts>
    </proxy>
  </proxies>
</settings>

to settings.xml in ~/.m2/settings.xml on Linux or <maven installation directory>\conf on Windows

####for example

# vim ~/.m2/settings.xml
<settings>
  <proxies>
   <proxy>
      <id>example-proxy</id>
      <active>true</active>
      <protocol>http</protocol>
      <host>1.2.3.4</host>
      <port>3128</port>
      <username>siva</username>
      <password>foobar</password>
      <nonProxyHosts>www.google.com|*.example.com</nonProxyHosts>
    </proxy>
  </proxies>
</settings>

##IBM Installation Manager (Windows)

Go to:

File > Preferences > Internet > HTTP Proxy

Select Enable proxy server and enter proxy details.

##PIP (Python Package Manager)

Append the following to any pip command:

--proxy http://<username>:<password>@<proxy>:<port>

####for example

sudo pip install --upgrade pip --proxy http://1.2.3.4:3128

##SSH (Client)

Add the following lines:

Host *             # (or any specific Host name)
    ProxyCommand          nc -X connect -x <proxy>:<port> %h %p
    ServerAliveInterval   10

to your ssh_config

####for example

# vim /etc/ssh/ssh_config
Host *             # (or any specific Host name)
    ProxyCommand          nc -X connect -x 1.2.3.4:3128 %h %p
    ServerAliveInterval   10

##SVN (Client)

Add the following lines:

http-proxy-host=<proxy>
http-proxy-port = <port>
http-proxy-compression = no

to your servers file usally found in ~/.subversion/servers on Linux and %APPDATA%\Subversion on Windows under the [global] tag

####for example

http-proxy-host=1.2.3.4
http-proxy-port = 3128
http-proxy-compression = no

##Netbeans

Go to:

Tools > Options > General

Select Manual Proxy Settings and enter proxy details.