If your RHEL 7 system is configured and running behind a proxy server then you may have to set up proxy for yum repository to access the repository running behind the proxy server on Red Hat Satellite Network.
Set up proxy for yum repository
There are two possible scenarios where you can setup proxy for yum repository.
Configure Proxy for All Repository
Now to set up proxy for yum for all the available repositories, you have to modify /etc/yum.conf
. Since this is the main configuration file for all the yum repository, adding proxy
here will set up proxy for yum for all the available repositories.
To add a proxy for all the available repository modify your /etc/yum.conf
file and add below line as highlighted
[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=3
proxy=http://user:password@proxy.example.com:3128
http
with https
Configure Proxy for Individual Repository
To add a proxy for individual repository only, you can directly modify the respective repo file inside /etc/yum.repos.d
# cat /etc/yum.repos.d/yum_repo.repo
[repo_yum]
name=yum_repo
baseurl=http://yumrepo.example.com/os
enabled=1
gpgcheck=0
proxy=http://user:password@proxy.example.com:3128
Ignore Proxy for Individual/All Repository
If you specifically want to make sure a repository does not use a proxy then add the below highlighted value in /etc/yum.conf
to apply for all the repositories or individual your repo file inside /etc/yum.repos.d
# cat /etc/yum.repos.d/rhel_no_proxy.repo
[repo_yum_no_proxy]
name=yum_repo_no_proxy
baseurl=http://yumrepo.example.com/os
enabled=1
gpgcheck=0
proxy=_none_
Lastly I hope the steps from the article to set up proxy for yum repository in Linux was helpful. So, let me know your suggestions and feedback using the comment section.
yum-config.manager -save -setopt=main.proxy=http://proxy:3128 should work.
For the life of me I could not get the YUM CLI to add a proxy to /etc/yum.repo.d/*.repo files:
This works, by adding entries to /etc/yum.conf: