Created
June 1, 2016 15:50
-
-
Save gotev/fd9400de12f7dbd288e934332bc8be61 to your computer and use it in GitHub Desktop.
Enable system-wise HTTP proxy on debian
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
#!/bin/bash | |
# Idea taken from example: https://codepoets.co.uk/2014/debian-http_proxy-setting/ | |
if [[ $EUID -ne 0 ]]; then | |
echo "This script has to be executed as root" 1>&2 | |
exit 1 | |
fi | |
if [ $# -ne 2 ]; then | |
echo "Usage: ./enable-proxy.sh PROXY_IP PROXY_PORT" | |
exit 2 | |
fi | |
echo "export http_proxy=http://$1:$2" > /etc/profile.d/proxy.sh | |
echo "Acquire::http::Proxy \"http://$1:$2\";" > /etc/apt/apt.conf.d/99HttpProxy | |
echo "http_proxy = http://$1:$2" >> /etc/wgetrc | |
echo "System-wise proxy set to $1:$2" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To install a proxy server with
squid
onCentOS 7
(I assume you have root access):Add this to
/etc/sysconfig/iptables
:and then execute: