How to configure proxy server in linux step by step

Configuring a proxy server in Linux can be done via graphical user interface (GUI) settingsenvironment variables for the current or all users, and application-specific configurations for tools like package managers

Method 1: Using the Graphical User Interface (GUI)

Method 1: Using the Graphical User Interface (GUI)

For users of desktop environments like GNOME (used in Ubuntu) or KDE, the easiest method is using the built-in network settings. 

  1. Open Settings: Navigate to your system’s main “Settings” application.
  2. Go to Network: Find and select the Network section.
  3. Access Network Proxy: Click on the “Network Proxy” option, typically represented by a gear icon or a dedicated tab.
  4. Select “Manual”: Change the proxy method from “None” or “Disabled” to “Manual”.
  5. Enter Proxy Details: Input the proxy server’s IP address (or hostname) and port number for the relevant protocols (HTTP, HTTPS, FTP, SOCKS).
  6. Apply Settings: The changes are often applied automatically or after you close the window, making the proxy effective system-wide for most applications that respect the desktop environment’s settings. Proxy-SellerProxy-Seller +4

Method 2: Using Environment Variables (Command Line)

This method is useful for server environments or when you need the proxy for terminal applications like curl and wgetGoogle DocsGoogle Docs +2

Temporary Configuration (Current Session Only) 

Run these commands in your terminal, replacing the placeholders with your actual proxy details: 

bash

export http_proxy="http://[proxy-address]:[port]"
export https_proxy="http://[proxy-address]:[port]"
export ftp_proxy="http://[proxy-address]:[port]"
export no_proxy="localhost,127.0.0.1,::1"

For an authenticated proxy, use the format: 

bash

export http_proxy="http://[username]:[password]@[proxy-address]:[port]"

These settings are lost when you close the terminal session. www.putorius.netwww.putorius.net +1

Permanent Configuration (For a Specific User)

To make the settings persist across sessions, add the above export lines to your shell’s configuration file (commonly ~/.bashrc or ~/.bash_profile). Google DocsGoogle Docs

  1. Open the file in a text editor (e.g., nano ~/.bashrc).
  2. Add the export lines at the end of the file.
  3. Save and exit the editor.
  4. Apply the changes by running source ~/.bashrc or by opening a new terminal session. Serverspace.usServerspace.us +4

Method 3: Configuring Package Managers

Some applications, including package managers like APT and YUM, do not automatically use system-wide environment variables and require separate configuration. Ask UbuntuAsk Ubuntu

For APT (Debian/Ubuntu)

Create or edit the configuration file in /etc/apt/apt.conf.d/SYNAY.NETSYNAY.NET

bash

sudo nano /etc/apt/apt.conf.d/proxy.conf

Add the following lines (adjust for authentication if needed): 

Acquire::http::Proxy "http://[proxy-address]:[port]/";
Acquire::https::Proxy "http://[proxy-address]:[port]/";

The changes take effect immediately the next time you use aptSYNAY.NETSYNAY.NET

For YUM/DNF (RHEL/CentOS/Fedora)

Edit the main YUM configuration file. RoseHostingRoseHosting

bash

sudo nano /etc/yum.conf

Under the [main] section, add the proxy details: 

ini

[main]
proxy=http://[proxy-address]:[port]
# If authentication is required:
proxy_username=[username]
proxy_password=[password]

Save the file to apply the changes. GitHub Pages documentationGitHub Pages documentation

Verification

You can verify your proxy settings using a command-line tool like curl to check your public IP address: 

bash

curl -I http://google.com

This should show the proxy server’s IP in the response headers if configured correctly. 

Leave a Reply

Your email address will not be published. Required fields are marked *