Configuring Proxy Settings in Ubuntu GUI & Terminal

Setting up a proxy in Ubuntu GUI is straightforward and can be done through the Settings menu. Follow these steps:

  1. Open the Settings menu on your Ubuntu system, go to the “Networks” section and select “Network Proxy.”

Step 1: Open the Ubuntu launcher, which is the dock on the left side of the screen.

Click on “Show applications” to search for programs. In the search prompt, type “Network” and click on “Settings > Network” to access the network settings.

Step 2: In the dialog that opens after clicking on “Network,” you will see three options: Wired, VPN, and Network Proxy. Click on “Network Proxy” to proceed.
Step 3: Once you are in the “Network Proxy” window, you will see three options: Automatic, Manual, and Disabled. By default, “Disabled” will be selected. To configure a proxy server, click on “Manual.” This will bring up additional text boxes where you can set the proxy settings for HTTP, HTTPS, FTP, and SOCKS protocols.

New address: gw.dataimpulse.com
Port: 823

That’s it! When you close the “Network Proxy” window, the changes will be saved automatically, and the system-wide proxy will be activated.

Now, let’s move on to learning how to set up a proxy from the terminal.

How to set up a proxy in Ubuntu terminal

Let’s start with setting up a proxy in the Ubuntu terminal. There are several methods available, but we’ll begin with temporary proxy settings using proxy environment variables.

To set up a temporary proxy for the current terminal session, follow these steps:

  • Open a new terminal by either clicking on the terminal icon or using the shortcut “CTRL + ALT + T”.
  • In the terminal, enter the following commands to create two new environment variables:

export http_proxy="YourProxyPlanUsername:[email protected]:823"
export https_proxy="YourProxyPlanUsername:[email protected]:823"
      
        
        
        
      

Make sure to remove any spaces between the equal signs and variables. The export command is used to set new environment variables specifically for the current terminal session. You can confirm that the environment variables are active by executing the following command in the terminal.

export

Running this command will display all the active environment variables, including http_proxy and https_proxy, in the current session. The format for the string YourProxyPlanUsername:[email protected]:823 is :<YourProxyPlanPassword@:. In our example, we assume the proxy plan username is “username” and the proxy plan password is “password”. Please replace this information with the appropriate values.

After exporting these environment variables, the proxy will be active for all the following commands. You can verify if the proxy is activated by executing the command below and checking your IP address:

wget -qO- https://ip-api.com/

If you don’t have Wget installed on your computer then, you can also run it using URL.

Permanently configure proxies for all terminal sessions

To avoid the hassle of configuring the proxy settings every time you start a new terminal session, you can set up a permanent proxy configuration that will apply to all of your terminal sessions. The steps to configure the permanent proxy vary depending on the shell you are using, and they involve modifying the shell configuration file.

  1. To open the shell configuration file in the ZSH terminal, you can use the following command to edit it with the Vim editor:

vim ~/.zshrc

If you prefer using a different text editor like gedit or nano, you can replace “vim” with the name of your preferred text editor in the command. Additionally, if you are using the Bash shell instead of ZSH, you will need to edit the bash shell configuration file located at ~/.bashrc instead of ~/.zshrc

  1. Towards the end of the configuration file, add the following lines to define the “http_proxy” and “https_proxy” environment variables:

export http_proxy="YourProxyPlanUsername:[email protected]:823"
export https_proxy="YourProxyPlanUsername:[email protected]:823"
      
        
        
        
      

The pattern for setting up the “http_proxy” and “https_proxy” variables is identical to the temporary proxy.

  1. Now, we need to reload the configuration file to apply the changes. You can either open a new terminal session or use the following command in the existing terminal:

source ~/.zshrc

The proxy will remain active for the current user. The shell configuration file is loaded each time a new terminal is opened, ensuring that the environment variables are always available, even after restarting the computer.

If you want to enable the proxy for all users, you will need to add the same two lines mentioned above to the /etc/environment file.

Set up proxy for APT from terminal

To set up a proxy for APT from the terminal, additional steps are required. APT is the package manager used in Debian, Ubuntu, Linux Mint, and other similar distributions. It relies on repositories or directories that contain software packages which can be installed using simple commands. To configure a proxy for APT, we need to edit the /etc/apt/apt.conf file. Follow the steps below to open it using the vim editor:

vim /etc/apt/apt.conf

Now, add the below lines to activate DataImpulse’ Residential Proxy for APT:


Acquire::http::Proxy "http://YourProxyPlanUsername:[email protected]:823";
Acquire::https::Proxy "http://YourProxyPlanUsername:[email protected]:823";

      
        
        
        
      

Once you have set up the proxy for APT using DataImpulse’ Residential Proxy, it will be used automatically when you install or update applications or packages. Ensure that you set the appropriate server address and port number, and replace the username and password with the correct proxy plan credentials. Failure to do so may result in a 407 Authentication Required Error.