Home  >  Article  >  Operation and Maintenance  >  Detailed explanation of how to configure DNF proxy on Centos8

Detailed explanation of how to configure DNF proxy on Centos8

藏色散人
藏色散人forward
2021-01-06 16:37:164263browse

The following is the tutorial column of centos to introduce to you the Centos8 configuration DNF proxy method. I hope it will be helpful to friends in need!

Detailed explanation of how to configure DNF proxy on Centos8

##centos 8 Configuring DNF proxy method Centos 8 uses dnf instead of yum by default. The original yum configuration file (/etc/yum.conf) is linked to the dnf configuration file (/etc/dnf/dnf.conf) by default
Originally, you only need to change the yum configuration file for proxying The setting method is no longer easy to use.
Centos 8 needs to be modified as follows

cat /etc/dnf/dnf.conf[main]gpgcheck=1
installonly_limit=3
clean_requirements_on_remove=True#best=Trueproxy=http://Proxy_Ip:port
proxy_username=username
proxy_password=password

Modify /etc/rhsm/rhsm.conf (there is no need to create it yourself)


cat /etc/rhsm/rhsm.conf

proxy_hostname = Proxy_Ip
proxy_port = Port
proxy_user = Username
proxy_password = Password

After the above settings are completed, dnf may still not be available. Install, then change the source configuration.

centos 8 uses three sources by default, the locations are as follows

/etc/yum.repos.d/CentOS-AppStream.repo
/etc/yum.repos.d/CentOS-Base.repo
/etc/yum.repos.d/CentOS-Extras.repo

Each repo file has two addresses, one starting with "mirrorlist=" and the other "baseurl=", the default is "mirrorlist=" , if you still cannot use dnf after configuring the proxy, comment out the addresses starting with "mirrorlist=" in the above three files and use the addresses starting with "baseurl=".

centos 8 Configuring DNF proxy method

centos 8 uses dnf instead of yum by default, the original yum configuration file (/etc/ yum.conf) is linked to the dnf configuration file (/etc/dnf/dnf.conf) by default
The original method of simply changing the yum configuration file for proxy settings is no longer easy to use.
centos 8 needs to be modified as follows

cat /etc/dnf/dnf.conf[main]gpgcheck=1
installonly_limit=3
clean_requirements_on_remove=True#best=Trueproxy=http://Proxy_Ip:port
proxy_username=username
proxy_password=password

Modify /etc/rhsm/rhsm.conf (there is no need to create it yourself)

cat /etc/rhsm/rhsm.conf

proxy_hostname = Proxy_Ip
proxy_port = Port
proxy_user = Username
proxy_password = Password

After the above settings are completed, you may still be unable to use dnf to install, continue Come down and change the source configuration.

centos 8 uses three sources by default, the locations are as follows

/etc/yum.repos.d/CentOS-AppStream.repo
/etc/yum.repos.d/CentOS-Base.repo
/etc/yum.repos.d/CentOS-Extras.repo

Each repo file has two addresses, one starting with "mirrorlist=" and the other "baseurl=", the default is "mirrorlist=" , if you still cannot use dnf after configuring the proxy, comment out the addresses starting with "mirrorlist=" in the above three files and use the addresses starting with "baseurl=".

The above is the detailed content of Detailed explanation of how to configure DNF proxy on Centos8. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete