Skip to content

Instantly share code, notes, and snippets.

@qnub
Last active December 8, 2016 10:53
Show Gist options
  • Save qnub/5a79b7726596df1641d44a9c3b95586c to your computer and use it in GitHub Desktop.
Save qnub/5a79b7726596df1641d44a9c3b95586c to your computer and use it in GitHub Desktop.
Init apt with proxy and install python2.7 for ansible
#!/usr/bin/env bash
HTTP_PROXY=$1
HTTPS_PROXY=$2
if [ -z "$HTTPS_PROXY" ]; then
HTTPS_PROXY=$HTTP_PROXY
fi
sudo mkdir -p /etc/apt/apt.conf.d
sudo touch /etc/apt/apt.conf.d/30proxy
cat << EOF | sudo tee /etc/apt/apt.conf.d/30proxy
Acquire::http::Proxy "$HTTP_PROXY";
Acquire::https::Proxy "$HTTPS_PROXY";
EOF
sudo apt update && sudo apt install -y python2.7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment