Introduction
This is another article where the main focus is just to configure yum tool so that it can properly run using proxy connection. Basically, this is an alternative for connecting to the internet in order to retrieve suitable package for further installation. It is common finding out that the network area where the server or machine running the yum command has a connection restriction. Because of that restriction, the yum command cannot connect to the internet and run properly.
Configuring yum tool to run under a Proxy Connection
Actually, adding a proxy connection to yum tool configuration is an alternative to be able to the connection. Just find the yum configuration file and fill it with the correct configuration line. Normally, the yum configuration file exist in ‘/etc/yum.conf’. The following is part of the content of the original yum configuration file :
[main] cachedir=/var/cache/yum/$basearch/$releasever keepcache=0 debuglevel=2 logfile=/var/log/yum.log exactarch=1 obsoletes=1 gpgcheck=1 plugins=1 installonly_limit=5 bugtracker_url=http://bugs.centos.org/set_project.php?project_id=23&ref=http://bugs.centos.org/bug_report_page.php?category=yum distroverpkg=centos-release ....
Just add the following line to the ‘[main]’ block :
proxy=http://xxx.xxx.xxx.xxx:xxx
So, overall the yum configuration file will be as in the following changes :
[main] cachedir=/var/cache/yum/$basearch/$releasever keepcache=0 debuglevel=2 logfile=/var/log/yum.log exactarch=1 obsoletes=1 gpgcheck=1 plugins=1 installonly_limit=5 bugtracker_url=http://bugs.centos.org/set_project.php?project_id=23&ref=http://bugs.centos.org/bug_report_page.php?category=yum distroverpkg=centos-release proxy=http://xxx.xxx.xxx.xxx:xxx ....
Before adding the address of the web proxy ‘xxx.xxx.xxx.xxx:xxx’ along with its port ‘:xxx’, just consult it with anyone who know about it. Normally, the network or system administrator in the network area should know about this if there is a specific web proxy server.
Finally, just start the yum command once more. It will use the connection to the internet using a proxy connection. The proxy connection itself exist as in the definition in the yum configuration file. Just run the ‘yum’ command with any additional parameter. For an example, the following is one of them :
[root@localhost ~]# yum clean all Loaded plugins: fastestmirror Cleaning repos: base docker-ce-stable epel extras pgdg-common pgdg10 pgdg11 pgdg12 pgdg13 pgdg14 pgdg96 updates Cleaning up list of fastest mirrors [root@localhost ~]#