Skip to content

How to Configure Proxy Settings in Linux

Post updated December 5, 2026

Here are two different ways to configure Linux to recognize a proxy server or proxy configuration file.

Export Command for Proxy Environment Variables

Section titled “Export Command for Proxy Environment Variables”

photo credit: jondoe

Use the following commands to configure your proxy for http and ftp traffic on the command line:

Terminal window
​# Set proxy environment variables
export http_proxy=http://proxy-adress:port/
export ftp_proxy=http://proxy-adress:port/
# If your proxy requires login/authentication, you can use the format:
​# Set proxy environment variable with credentials
export http_proxy=http://USERNAME:PASSWORD@proxy-adress:port/
# To have this applied every time you log in, place these lines in your
# .bashrc in your home (~) directory.
# Add to .bashrc
export http_proxy=http://proxy-address:port/
export ftp_proxy=http://`proxy-address:port/

Example Proxy Settings Using the Above Instructions

Section titled “Example Proxy Settings Using the Above Instructions”

Using an example proxy 1.2.3.4 port 3128

Add these lines to etc/environment or shell initialization like ~/.bashrc

Terminal window
​# Add to shell environment
​# bash/zsh
export http_proxy="http://1.2.3.4:3128/"
export https_proxy="http://1.2.3.4:3128/"

Perhaps you need to set a proxy temporarily and remove it later. These sets of commands can be run or put in a script to run when the proxy should be set up and then removed later.

Terminal window
​# set proxy
export http_proxy=http://1.2.3.4:3128
export https_proxy=http://1.2.3.4:3128
​# unset / remove proxy
unset http_proxy
unset https_proxy

For GNOME, go to Computer->Desktop Preferences->Network Proxy For KDE desktop manager, you can get to the network proxy settings under System Settings > Network Settings > Proxy

In the setting, you can configure either by your proxy server and port, by the network, or a file via a URL/file location (e.g. http://myproxyserver:port/proxyfile.pac) .

These settings work with most other applications (e.g. other browsers like Firefox, Chrome, OS commands).

Configure some applications and commands individually. Below are common examples.

You can manually set up the Firefox proxy in Options. Go to the General tab then Network Settings.

In older versions, go to Options > Advanced > Settings.

yum proxy settings can be found in the file system at /etc/yum.conf

Add a line to the file with the following information: proxy=http://proxy-address:port/ The next time you run yum, it will pick up that proxy.

Here is a similar how to article on configuring proxy settings in Ubuntu covering Synaptic Package Manager, Gnome, apt-get, and Firefox.

To set the proxy used by Aptitude package manager:

Create a new file proxy.conf under the /etc/apt/apt.conf.d/ directory, and then add the lines shown below. For example:

Terminal window
# Open configuration file with nano editor
sudo nano /etc/apt/apt.conf.d/proxy.conf
# In editor, add these lines
Acquire {
HTTP::proxy "http://1.2.3.4:3128";
HTTPS::proxy "http://1.2.3.4:3128";
}