Skip to content

blcoffee/linux-proxy-setup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

linux-proxy-setup

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.

What it configures

# 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

Requirements

  • Ubuntu 24.04 (or any modern Debian-based distro)
  • bash 4+
  • python3 (for Docker JSON config, Maven XML, Claude Code JSON, and URL encoding)
  • sudo access for system-wide targets (apt, /etc/environment, Docker, snap) — user-level targets work without it

Quick start

bash <(curl -fsSL https://raw.githubusercontent.com/blcoffee/linux-proxy-setup/main/setup_proxy.sh)

Usage

Interactive mode (recommended)

bash setup_proxy.sh

The script will prompt for a proxy address and optional credentials.

Direct mode

# Without authentication
bash setup_proxy.sh http://127.0.0.1:7890

# With authentication
bash setup_proxy.sh http://proxy.example.com:8080 admin secret123

Clear all proxy settings

bash setup_proxy.sh --clear

This removes every proxy block this script added, across all supported tools.

Apply to current shell

After running the script, reload your shell to pick up the new environment variables:

source ~/.bashrc

Notes

  • The script inserts a clearly-marked block (# >>> proxy setup >>>) in shell profiles so it can be cleanly removed by --clear without touching anything else.
  • Tools that are not installed are silently skipped with a warning.
  • Targets that require sudo are skipped gracefully when passwordless sudo is unavailable.
  • Credentials are URL-encoded automatically when building the proxy URL.

License

MIT

About

One-shot Bash script to configure system-wide HTTP/HTTPS proxy on Ubuntu 24.04 across shell, git, apt, pip, npm, docker, and more

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages