Replace your proxy hostname and port number instead of webcache.cs.bham.ac.uk:3128
below.
Set the following in your .bashrc
file:
export HTTP_PROXY=http://webcache.cs.bham.ac.uk:3128
export HTTPS_PROXY=http://webcache.cs.bham.ac.uk:3128
export FTP_PROXY=http://webcache.cs.bham.ac.uk:3128
export http_proxy=http://webcache.cs.bham.ac.uk:3128
export https_proxy=http://webcache.cs.bham.ac.uk:3128
export ftp_proxy=http://webcache.cs.bham.ac.uk:3128
Add following lines to /etc/apt/apt.conf
:
Acquire::http::Proxy "http://webcache.cs.bham.ac.uk:3128";
Acquire::https::Proxy "http://webcache.cs.bham.ac.uk:3128";
Acquire::ftp::Proxy "http://webcache.cs.bham.ac.uk:3128";
NOTE: For apt-add-repository
you might need to add the -E
flag after sudo
in the command.
Run the following commands:
sudo snap set system proxy.http="http://webcache.cs.bham.ac.uk:3128"
sudo snap set system proxy.https="http://webcache.cs.bham.ac.uk:3128"
Instead of apt-key adv
command, use curl -sSL 'http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x<GPG_KEY>' | apt-key add -
This has to be done if you want to use docker services behind proxy:
- Create the following folder
sudo mkdir -p /etc/systemd/system/docker.service.d
- Open new file:
sudo nano /etc/systemd/system/docker.service.d/http-proxy.conf
- Add the following lines to the file
[Service]
Environment="HTTP_PROXY=http://webcache.cs.bham.ac.uk:3128/"
Environment="HTTP_PROXY=http://webcache.cs.bham.ac.uk:3128/"
Environment="HTTP_PROXY=http://webcache.cs.bham.ac.uk:3128/"
If you want to build docker images which require internet, do the following:
- Create the following folder (if it doesn't exist):
mkdir ~/.docker/
- Open file:
nano ~/.docker/config.json
- Add the following lines to it:
{
"proxies":
{
"default":
{
"httpProxy": "http://webcache.cs.bham.ac.uk:3128",
"httpsProxy": "http://webcache.cs.bham.ac.uk:3128",
"ftpProxy": "http://webcache.cs.bham.ac.uk:3128"
}
}
}
- Restart docker service:
sudo systemctl daemon-reload
sudo systemctl restart docker