Most of the time the Corporate Linux servers are behind multiple firewalls and internet access being blocked. This serverly affects the Linux servers agility in accessing the required packages. Easier and safer way would be via corporate firewall. As the package repositories work on HTTPS.

RHEL Linux

Edit the .repo files which usually lives under /etc/yum.repos.d

For each enabled repositores add a line as below.

proxy=http://YOUR-USERNAME:YOUR-PASSWORD@PROXY-IP:PROXY-PORT/

**Example**

[zabbix]
name=Zabbix Official Repository - $basearch
baseurl=http://repo.zabbix.com/zabbix/5.0/rhel/7/$basearch/
proxy=http://internetuser:SecretPassword123@10.10.10.10:8080/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591

Ubuntu or Debian Flavours

Edit the file /etc/apt/apt.conf.d/00proxy and add a line as follows...
Acquire::http::Proxy "proxy=http://YOUR-USERNAME:YOUR-PASSWORD@PROXY-IP:PROXY-PORT/";

Now both the RHEL and Ubuntu should be able to fetch packages. Make sure the .deb and .rpm are whitelisted in proxy. Also better to whitelist the domains required by package managers.

Test