Image

Knowledge base → Setting up a proxy for a repository in Linux

[Virtual servers]
Date of publication: 18.01.2024

There are tasks when you need to configure the reception of updates for a specific repository, for example from another country. Since the VPN extends its network to the entire server, this option is not suitable, since we need to use a separate network only to receive updates.

In Linux there is such a solution - you can assign a separate proxy server both for all repositories, and for each one separately.

1. Use a proxy for all /etc/yum.conf repositories

[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

If the proxy server works via https, change this parameter in the line.

1.1 Using a proxy server for one repository /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

1.2 Ignoring the proxy server for a separate repository.

This rule is only relevant when using rule 1, i.e. when the proxy is enabled globally. You can add proxy ignore for a specific repository.

# 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_

Done, now you can configure separate repositories for separate proxy servers.





No Comments Yet