Configuring a Global Proxy
You configure global HTTP and HTTPS proxies in the /etc/profile.d/
directory of Cumulus Linux. Set the http_proxy
and https_proxy
variables to configure the switch with the address of the proxy server you want to use to get URLs on the command line. This is useful for programs such as apt
, apt-get
, curl
and wget
, which can all use this proxy.
In a terminal, create a new file in the
/etc/profile.d/
directory.cumulus@switch:~$ sudo nano /etc/profile.d/proxy.sh
Add a line to the file to configure either an HTTP or an HTTPS proxy, or both:
HTTP proxy:
http_proxy=http://myproxy.domain.com:8080 export http_proxy
HTTPS proxy:
https_proxy=https://myproxy.domain.com:8080 export https_proxy
Create a file in the
/etc/apt/apt.conf.d
directory and add the following lines to the file to get the HTTP and HTTPS proxies. The example below useshttp_proxy
as the file name:cumulus@switch:~$ sudo nano /etc/apt/apt.conf.d/http_proxy Acquire::http::Proxy "http://myproxy.domain.com:8080"; Acquire::https::Proxy "https://myproxy.domain.com:8080";
Add the proxy addresses to the
/etc/wgetrc
file, then uncomment thehttp_proxy
andhttps_proxy
lines, if necessary:cumulus@switch:~$ sudo nano /etc/wgetrc ... https_proxy = https://myproxy.domain.com:8080 http_proxy = http://myproxy.domain.com:8080 ...
To execute the
/etc/profile.d/proxy.sh
file in the current environment, run thesource
command:cumulus@switch:~$ source /etc/profile.d/proxy.sh
Use the echo
command to confirm the configuration:
HTTP proxy:
cumulus@switch:~$ echo $http_proxy http://myproxy.domain.com:8080
HTTPS proxy:
cumulus@switch:~$ echo $https_proxy https://myproxy.domain.com:8080