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.
dnf
configuration file in a text editor. The file is usually located at /etc/dnf/dnf.conf
.sudo nano /etc/dnf/dnf.conf
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
Save the file and exit the text editor.
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