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:
# Set proxy environment variablesexport 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 credentialsexport 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 .bashrcexport 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
# Add to shell environment# bash/zshexport http_proxy="http://1.2.3.4:3128/"export https_proxy="http://1.2.3.4:3128/"Temporary proxy settings
Section titled “Temporary proxy settings”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.
# set proxyexport http_proxy=http://1.2.3.4:3128export https_proxy=http://1.2.3.4:3128
# unset / remove proxyunset http_proxyunset https_proxyNetwork Proxy Settings
Section titled “Network Proxy Settings”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).
Program/Application Level
Section titled “Program/Application Level”Configure some applications and commands individually. Below are common examples.
Firefox
Section titled “Firefox”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.
Fedora — Yum Package Manager
Section titled “Fedora — Yum Package Manager”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.
Ubuntu
Section titled “Ubuntu”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:
# Open configuration file with nano editorsudo nano /etc/apt/apt.conf.d/proxy.conf
# In editor, add these linesAcquire { HTTP::proxy "http://1.2.3.4:3128"; HTTPS::proxy "http://1.2.3.4:3128";}