This guide explains how to configure your system to connect to a proxy server using the terminal.
Setting up a proxy server through your system's network settings allows applications like web browsers to use the proxy. However, this method does not configure the terminal to use the proxy. If you need to use a proxy server for terminal commands like apt-get, you must configure the proxy specifically for the terminal.
When you configure a proxy through the network settings, it typically only applies to GUI-based applications like web browsers. The terminal operates independently of these settings and requires manual configuration to use a proxy. This is why it’s necessary to follow the steps above to ensure that terminal commands are routed through the proxy server.
- Open the terminal on your machine.
- Run the following command to open the configuration file:
sudo gedit /etc/apt/apt.conf
This will open the configuration file in a text editor. Copy the statements below and modify them by replacing username with your username, password with your password, hostelinternet.rgukt.ac.in with your domain and 3128 with your proxy server's port number:
Acquire::http::Proxy "http://username:password@hostelinternet.rgukt.ac.in:3128/";
Acquire::https::Proxy "http://username:password@hostelinternet.rgukt.ac.in:3128/";
Acquire::socks::Proxy "http://username:password@hostelinternet.rgukt.ac.in:3128/";
Acquire::ftp::Proxy "http://username:password@hostelinternet.rgukt.ac.in:3128/";
Save the file and close the editor.
Verify the Proxy Configuration
To ensure that the proxy server is correctly configured, run the following command in the terminal:
sudo apt-get updateIf the proxy is working correctly, you should see a successful connection message.