How To Upgrade From Fedora 20 To Fedora 21 Using FedUp

How do I access and use dnf command with a web proxy server on a Fedora Linux? How do I configure dnf to use a proxy server only?

Dnf repositories (“repos”) can be accessed through standard proxy servers such as Squid or any other proxy server. You need to configure the proxy server in /etc/dnf/dnf.conffile as follows:

  1. proxy=http://URL:PORT/ – Proxy serer URL to the proxy server that yum should use. You must set a complete URL, including the TCP port number. If your corporate proxy server requires a username and password, specify these by adding following two settings in dnf.conf file.
  2. proxy_username=YOUR-PROXY-USERNAME-HERE (optional)- Your proxy server username to use for the proxy URL.
  3. proxy_password=YOUR-SUPER-secrete-PASSWORD-HERE (optional) – Your proxy server password for this proxy URL.

Configuration: Using dnf with a proxy server

First, login as root user and type (open the Terminal app if you are using GUI based Fedora workstation):
# vi /etc/dnf/dnf.conf
$ sudo vi /etc/dnf/dnf.conf
Add/append/edit the following settings in [main] section:

Save and close the file. Here is my complete working config /etc/dnf/dnf.conf file:

Please note that defining a proxy server, username, and password in dnf.conf file means all users connect to the proxy server with those details when using dnf command:
# dnf update
# dnf install foo

How do I enable proxy access for a specific user such as root user only?

Type the following command at shell prompt:

# export http_proxy=""
# export http_proxy=""

Feel free to add the above line in the to your shell profile file such as ~/.bash_profile.