Forked from devops-school/http-proxy-linux-yum-apt.sh
Created
April 28, 2022 19:45
-
-
Save mnanchev/c3bf162d3006d0193a71df75eec19352 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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:[email protected]:8080 | |
export https_proxy=username:[email protected]: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