Menu

How to Set Up Proxy in Linux

Taufik Nurhidayat
3 min read
#linux #tutorial

Proxy will always be part of Linux. Can we set up a proxy server on the Linux operating system? It turns out it's quite easy.

social_cards/proxy-thumbnail_c4jmfn.png

Proxy will always be part of the Linux operating system. Linux itself is known as an operating system used for servers. If it concerns a Linux server, you might hear about proxies. According to Wikipedia, a proxy is an intermediary (between a computer system or application) that acts as an intermediary for requests from clients seeking resources from other servers. Client A connects to the intermediary server, requesting some service, such as a file, connection, page, or other resource, which is available from a different server.

Using Settings

To set up a proxy on the Linux operating system, you can do it through the settings. You just need to open settings and go to Network > Settings > Proxy.

UI Settings Proxy Display

You can choose which proxy you want to use. In the “Detect proxy configuration automatically” section, it will automatically detect proxy settings. This applies if a network implements it, for example, a company or university sets up automatic proxy, then you set it to automatic detection, and the proxy can be used.

For the “Use proxy configuration URL” section, it is also an automatic proxy setting, but you need to fill in the URL that leads to the proxy configuration file, usually with a “.pac” extension.

In the “Use system” and “Manual” sections, I don’t think there’s any difference. In this section, you have to fill in the proxy yourself. Perhaps in the “Use system proxy” section, it will be filled automatically if the system proxy has been set up on your Linux.

If you don’t want to use a proxy, just select the “No proxy” section.

The proxy format is like this: http://USERNAME:PASSWORD@PROXYIP:PROXYPORT

If the proxy does not require authentication, then just use proxy:port.

http://PROXYIP:PROXYPORT

Example with authentication:

http://taufik:[email protected]:8080

Without authentication:

http://192.168.43.1:8080

Using Terminal

The proxy has been set up through the Linux settings, but when using the Linux terminal, the proxy does not work, so you have to set up the system proxy through the terminal.

Open the Linux terminal, you can use the shortcut Ctrl+T, and type the following command.

sudo nano /etc/environment

Then fill in the text with the following format at the very end.

http_proxy="http://USERNAME:PASSWORD@PROXYIP:PROXYPORT"
https_proxy="http://USERNAME:PASSWORD@PROXYIP:PROXYPORT"
ftp_proxy="http://USERNAME:PASSWORD@PROXYIP:PROXYPORT"
no_proxy="localhost,127.0.0.1,::1"

Terminal Display When Setting Proxy Settings

The proxy format is also the same as in the first section, which is:

http://USERNAME:PASSWORD@PROXYIP:PROXYPORT

If you don’t want to use a proxy but still want to save the settings in case you need them in the future, just add # at the beginning of each line.

Commenting Out Proxy Settings File

Final Words

That’s how to set up a proxy in Linux. By using a proxy, your connection to the internet will also be more secure, and usually, blocked content like Reddit will also open.