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

https://‮w‬ww.lautturi.com
Fedora Linux - How to Use dnf Command With A Proxy Server

To use the dnf command with a proxy server in Fedora Linux, you will need to specify the proxy server details in the dnf configuration file.

  1. Open the dnf configuration file in a text editor. The file is usually located at /etc/dnf/dnf.conf.
sudo nano /etc/dnf/dnf.conf
  1. Add the following lines to the file, replacing PROXY_SERVER_URL and PROXY_PORT with the URL and port of your proxy server:
proxy=PROXY_SERVER_URL:PROXY_PORT

For example, if your proxy server URL is http://myproxy.example.com and the port is 3128, you would add the following line:

proxy=http://myproxy.example.com:3128
  1. Save the file and exit the text editor.

  2. Test the configuration by running a dnf command, such as dnf update. If the proxy server is configured correctly, the dnf command should run successfully.

If you want to specify a different proxy server for a specific repository, you can add the proxy option to the repository configuration in the /etc/dnf/dnf.repos.d directory. For example, to specify a proxy server for the fedora repository, you would add the following lines to the fedora.repo file in the /etc/dnf/dnf.repos.d directory:

[fedora]
proxy=PROXY_SERVER_URL:PROXY_PORT
Created Time:2017-10-28 20:14:17  Author:lautturi