Using HTTP Proxy Server - Debian 11
Due to current events that sometimes cost me time I would like to have some information about Debian 11 in this post and write down the use of proxy servers as required to see again here. So also other of my notes I make them publicly accessible directly here.
Configure proxy servers for using Apt (package manager)
To install packages, apt requires information about proxy
Servers to connect to target servers
can.
If not done in the setup, this can be easily reconfigured
vi /etc/apt/apt.conf
Acquire::http::Proxy "http://<<ip>>:<<port>>";
oder (wenn Userdaten benötigt werden)
Acquire::http::Proxy "http://<<username>>:<<password>>@<<ip>>:<<port>>";
(Die jeweiligen "<<" und ">>" sind ebenfalls zu entfernen)
Set system variables (automatically used by many programs)
export http_server=http://<<username>>:<<password>>@<<ip>>:<<port>>/
export https_server=https://<<username>>:<<password>>@<<ip>>:<<port>>/
Configuration of proxy in the bash
vi /etc/bash.bashrc
export http_proxy=http://<<USERNAME>>:<<PASSWORD>>@<<SERVER>>:<<PORT>>/
Configuration of proxy in the “enviroment” file
vi /etc/environment/
http_proxy="http://<<user>>:<<password>>@<<ip>>:<<port>>/
https_proxy="http://<<user>>:<<password>>@<<ip>>:<<port>>/
Using Curl Proxy automatically
vi ~/.bashrc
alias curl="curl -x <<username>>:<<password>>@<<ip>>:<<port>>"
ALTERNATIV
vi ~/.curlrc
proxy = <<username>>:<<password>>@<<ip>>:<<port>>
Use Service Drop-In (e.g. for containerD)
mkdir -p /etc/systemd/system/containerd.service.d
vi /etc/systemd/system/containerd.service.d/http-proxy.conf
[Service]
Environment="HTTP_PROXY=http://<<ip>>:<<port>>
This also works analogously with NO_PROXY and HTTPS_PROXY
Finally, the respective service and the daemon must be restarted so that all changes are taken over
sudo systemctl daemon-reload
sudo service containerD restart
When entering
As always, I give no guarantee that this information is correct, or is best suited or complete.
Back…