Skip to content

Instantly share code, notes, and snippets.

@devops-school
Created October 9, 2019 04:59
Show Gist options
  • Save devops-school/9ae2f42a10637dc481fd33b354723579 to your computer and use it in GitHub Desktop.
Save devops-school/9ae2f42a10637dc481fd33b354723579 to your computer and use it in GitHub Desktop.
Method 1 – Using /etc/environment - Set up http proxy permanently using /etc/environment
======================================================================
http_proxy="http://myproxy.server.com:8080/"
https_proxy="http://myproxy.server.com:8080/"
ftp_proxy="http://myproxy.server.com:8080/"
no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com"
HTTP_PROXY="http://myproxy.server.com:8080/"
HTTPS_PROXY="http://myproxy.server.com:8080/"
FTP_PROXY="http://myproxy.server.com:8080/"
NO_PROXY="localhost,127.0.0.1,localaddress,.localdomain.com"
Method 2 – Using yum.conf - Setting proxy for other programs such as yum
======================================================================
vi /etc/yum.conf
# vi /etc/yum.conf
proxy=http://proxy.example.com:3128
proxy_username=yum-user
proxy_password=qwerty
Method 3 – Using /root/.bashrc
======================================================================
export http_proxy=username:password@proxyhost.com:8080
export https_proxy=username:password@proxyhost.com:8081
export no_proxy=localhost, 127.0.0.1, *.my.lan
Method 4 – apt-get, aptitude, etc
======================================================================
apt-get, aptitude, etc. will not obey the environment variables when used normally with sudo. So separately configure them; create a file called 95proxies in /etc/apt/apt.conf.d/, and include the following:
Acquire::http::proxy "http://myproxy.server.com:8080/";
Acquire::ftp::proxy "ftp://myproxy.server.com:8080/";
Acquire::https::proxy "https://myproxy.server.com:8080/";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment