Last active
August 29, 2015 14:17
-
-
Save jpcercal/2c3d85012fbe8e397674 to your computer and use it in GitHub Desktop.
Terminal Proxy Setup
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
| # Credentials | |
| export PROXY_SERVER_IP="proxyserver.com" | |
| export PROXY_SERVER_PORT="3128" | |
| export PROXY_USERNAME="your-user" | |
| export PROXY_PASSWORD="your-password@123" | |
| PROXY_CONFIG="http://${PROXY_USERNAME/\@/%40}:${PROXY_PASSWORD/\@/%40}@${PROXY_SERVER_IP}:${PROXY_SERVER_PORT}/" | |
| # System | |
| export {http,HTTP,https,HTTPS}_{proxy,PROXY}=$PROXY_CONFIG | |
| # Curl | |
| [ ! -f $HOME/.curlrc ] && { | |
| echo "# Proxy config" >> $HOME/.curlrc | |
| echo "proxy=\"${PROXY_SERVER_IP}:${PROXY_SERVER_PORT}"\" >> $HOME/.curlrc | |
| echo "proxy-user=\"${PROXY_USERNAME}:${PROXY_PASSWORD}\"" >> $HOME/.curlrc | |
| } | |
| # Apt | |
| [ ! -f /etc/apt/apt.conf ] && { | |
| echo "# Proxy config" >> /etc/apt/apt.conf | |
| echo "Acquire::http::proxy \"${PROXY_CONFIG}\";" >> /etc/apt/apt.conf | |
| echo "Acquire::https::proxy \"${PROXY_CONFIG}\";" >> /etc/apt/apt.conf | |
| echo "Acquire::ftp::proxy \"${PROXY_CONFIG}\";" >> /etc/apt/apt.conf | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment