To set up a system-wide proxy configuration:
-
Open
~/.profilein your preferred text editor:vi ~/.profile -
Add the following lines at the end of the file:
export http_proxy=http://proxy_server_address:proxy_port export https_proxy=https://proxy_server_address:proxy_port export no_proxy=localhost, ::1,127.0.0.1
-
Apply the changes:
source ~/.profile
To configure the APT package manager:
-
Open
/etc/apt/apt.confwith root privileges:sudo vi /etc/apt/apt.conf
-
Paste the following configuration:
Acquire::http::Proxy "http://proxy_server_address:proxy_port"; Acquire::https::Proxy "https://proxy_server_address:proxy_port"; -
Save the file and exit.
To configure the DNF package manager:
-
Open /etc/dnf/dnf.conf with root privileges:
sudo vi /etc/dnf/dnf.conf
-
Add or modify the following lines in the [main] section:
proxy=http://<proxy_addr>:<proxy_port> -
Save the file and exit.
To set proxy settings for the Snap package manager:
sudo snap set system proxy.http="http://proxy_server_address:proxy_port"
sudo snap set system proxy.https="https://proxy_server_address:proxy_port"To configure Git with or without authentication for proxy:
Without authentication:
git config --global http.proxy http://proxy_server_address:proxy_port
git config --global https.proxy https://proxy_server_address:proxy_portIf your proxy requires authentication, you can include your username in the URL:
git config --global http.proxy http://username@proxy_server_address:proxy_port
git config --global https.proxy https://username@proxy_server_address:proxy_portVerify the configuration: You can verify that the proxy settings are correctly configured by checking your Git configuration:
git config --global --get http.proxy
git config --global --get https.proxyUnset proxy configuration: If you want to remove the proxy configuration, you can unset it using:
git config --global --unset http.proxy
git config --global --unset https.proxyThis will revert Git to using no proxy.
-
Create the directory:
sudo mkdir -p /etc/systemd/system/docker.service.d
-
Create the file:
sudo vi /etc/systemd/system/docker.service.d/http-proxy.conf
-
Paste the following configuration and save the file:
[Service] Environment="HTTP_PROXY=http://proxy_server_address:proxy_port" Environment="HTTPS_PROXY=https://proxy_server_address:proxy_port" -
Restart daemon:
systemctl daemon-reload
-
Restart docker service:
service docker restart