A single Bash script that configures a system-wide HTTP/HTTPS proxy on Ubuntu 24.04 (and compatible distros) across every major tool in one shot.
| # | Target | Config file / method |
|---|---|---|
| 1 | Shell (bash / zsh) | ~/.bashrc, ~/.zshrc |
| 2 | System environment | /etc/environment |
| 3 | curl | ~/.curlrc |
| 4 | wget | ~/.wgetrc |
| 5 | git | git config --global |
| 6 | apt | /etc/apt/apt.conf.d/99proxy |
| 7 | pip | ~/.config/pip/pip.conf |
| 8 | npm | ~/.npmrc |
| 9 | yarn | ~/.yarnrc / ~/.yarnrc.yml |
| 10 | pnpm | ~/.npmrc |
| 11 | Docker | systemd drop-in + ~/.docker/config.json |
| 12 | snap | snap set system proxy.* |
| 13 | Claude Code | ~/.claude/settings.json |
| 14 | Go | go env GOPROXY |
| 15 | Rust / cargo | ~/.cargo/config.toml |
| 16 | Maven | ~/.m2/settings.xml |
| 17 | Gradle | ~/.gradle/gradle.properties |
| 18 | .NET / NuGet | via HTTP_PROXY env var |
| 19 | uv | via HTTP_PROXY env var |
- Ubuntu 24.04 (or any modern Debian-based distro)
bash4+python3(for Docker JSON config, Maven XML, Claude Code JSON, and URL encoding)sudoaccess for system-wide targets (apt, /etc/environment, Docker, snap) — user-level targets work without it
bash <(curl -fsSL https://raw.githubusercontent.com/blcoffee/linux-proxy-setup/main/setup_proxy.sh)bash setup_proxy.shThe script will prompt for a proxy address and optional credentials.
# Without authentication
bash setup_proxy.sh http://127.0.0.1:7890
# With authentication
bash setup_proxy.sh http://proxy.example.com:8080 admin secret123bash setup_proxy.sh --clearThis removes every proxy block this script added, across all supported tools.
After running the script, reload your shell to pick up the new environment variables:
source ~/.bashrc- The script inserts a clearly-marked block (
# >>> proxy setup >>>) in shell profiles so it can be cleanly removed by--clearwithout touching anything else. - Tools that are not installed are silently skipped with a warning.
- Targets that require
sudoare skipped gracefully when passwordless sudo is unavailable. - Credentials are URL-encoded automatically when building the proxy URL.
MIT