When working behind a corporate firewall or a restricted network, you need to explicitly tell APT how to route its traffic. Instead of messing with global environment variables, the cleanest way is to create a dedicated configuration file.
1. Create the config file:
2. Add your proxy details:
Replace PROXY:PORT with your actual gateway (e.g., 10.0.0.1:3128).
Quick Tip: If your proxy requires authentication, use the format: http://user:password@proxy:port