Fedora Linux – How to Use dnf Command With A Proxy Server

The “dnf” command is the package manager for Fedora Linux. If you are behind a proxy server, you can configure dnf to use the proxy by setting the http_proxy and https_proxy environment variables. Here’s how:

  1. Open a terminal window.
  2. Set the http_proxy and https_proxy environment variables to the URL of your proxy server, including the port number. For example:
export http_proxy=http://proxy.example.com:8080
export https_proxy=http://proxy.example.com:8080
  1. To make these settings persistent, you can add the above lines to your shell profile file, such as ~/.bashrc or ~/.bash_profile.
  2. Verify the proxy settings by running the following command:
dnf config-manager --set-proxy
  1. Run the following command to test if the proxy is working:
dnf check-update

If the proxy is configured correctly, you should see the list of available updates. If you encounter any errors, make sure the URL and port number of your proxy server are correct, and that the proxy allows traffic to the required ports for dnf (usually port 80 for HTTP and port 443 for HTTPS).

Leave a Comment