How would I connect to a proxy on Ubuntu Studio? [duplicate]
I wrote a script in response to a question at Unix & Linux about setting proxies:
#! /bin/bash
HTTP_PROXY_HOST="proxy.example.com"
HTTP_PROXY_PORT=3128
HTTPS_PROXY_HOST="proxy.example.com"
HTTPS_PROXY_PORT=3128
gsettings set org.gnome.system.proxy mode manual
gsettings set org.gnome.system.proxy.http host "$HTTP_PROXY_HOST"
gsettings set org.gnome.system.proxy.http port "$HTTP_PROXY_PORT"
gsettings set org.gnome.system.proxy.https host "$HTTPS_PROXY_HOST"
gsettings set org.gnome.system.proxy.https port "$HTTPS_PROXY_PORT"
sudo sed -i.bak '/http[s]::proxy/Id' /etc/apt/apt.conf
sudo tee -a /etc/apt/apt.conf <<EOF
Acquire::http::proxy "http://$HTTP_PROXY_HOST:$HTTP_PROXY_PORT/";
Acquire::https::proxy "http://$HTTPS_PROXY_HOST:$HTTPS_PROXY_PORT/";
EOF
sudo sed -i.bak '/http[s]_proxy/Id' /etc/environment
sudo tee -a /etc/environment <<EOF
http_proxy="http://$HTTP_PROXY_HOST:$HTTP_PROXY_PORT/"
https_proxy="http://$HTTPS_PROXY_HOST:$HTTPS_PROXY_PORT/"
EOF
Save to a file (call it proxy.sh
), edit it using your favourite editor to set the values of the *_PROXY_*
variables and run:
chmod +x proxy.sh
./proxy.sh
It does, as far as I am aware, exactly what the GUI does (if based on a GNOME environment, which Ubuntu Studio is).
You can set your proxy via the terminal.
You should, for that, edit the following files:
/etc/bash.bashrc
/etc/environment
/etc/apt/apt.conf
/usr/local/etc/freshclam.conf
These files must have the following contents:
sudo -i
nano /etc/bash.bashrc
------------------------------------------------------------------
export http_proxy=http://username:[email protected]:port/
export https_proxy=http://username:[email protected]:port/
export ftp_proxy=http://username:[email protected]:port/
------------------------------------------------------------------
Control + O, save file.
sudo -i
nano /etc/environment
----------------------------------------------------------
http_proxy=http://username:[email protected]:port/
https_proxy=http://username:[email protected]:port/
ftp_proxy=http://username:[email protected]:port/
----------------------------------------------------------
Control + O, save file.
sudo -i
nano /etc/apt/apt.conf
--------------------------------------------------------------------
Acquire::http::Proxy "http://username:[email protected]:port";
Acquire::https::Proxy "http://username:[email protected]:port";
Acquire::ftp::Proxy "http://username:[email protected]:port";
---------------------------------------------------------------------
Control + O, save file.
sudo -i
nano /usr/local/etc/freshclam.conf
--------------------------------
HTTPProxyServer proxyserver.net
HTTPProxyPort port
HTTPProxyUsername username
HTTPProxyPassword password
--------------------------------
Control + O, save file. Control + X, close nano