Skip to content

Instantly share code, notes, and snippets.

@cinco
Forked from limingjie/UbuntuProxy.md
Created March 13, 2019 11:50
Show Gist options
  • Select an option

  • Save cinco/56491d1d2f0e802e807fad35c2deb30a to your computer and use it in GitHub Desktop.

Select an option

Save cinco/56491d1d2f0e802e807fad35c2deb30a to your computer and use it in GitHub Desktop.
Ubuntu Proxy Configuration

Ubuntu Proxy Configuration

Tested under Ubuntu 14.04.2 LTS

Global Proxy

Add proxies in /etc/environment

$ sudo vi /etc/environment
# Proxies
http_proxy="http://proxy.server.com:port/"
https_proxy=$http_proxy
ftp_proxy=$http_proxy
rsync_proxy=$http_proxy
no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com"

Proxy for sudoers

Add proxies in /etc/sudoers. It is to keep proxies working when execute command via sudo.

$ sudo vi /etc/sudoers
Defaults env_keep +="http_proxy"
Defaults env_keep +="https_proxy"
Defaults env_keep +="ftp_proxy"

APT Proxy

Add proxies in /etc/apt/apt.conf

$ sudo vi /etc/apt/apt.conf
# Proxy
Acquire::http::Proxy "http://proxy.server.com:port/";

Rubygems Proxy

Use --http-proxy to specify proxy.

$ sudo gem install --http-proxy http://proxy.server.com:port/ tmuxinator

Git Proxy

$ git config --global http.proxy http://proxy.server.com:port/
$ git config --global https.proxy http://proxy.server.com:port/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment