找一台可以上网的机器
[root@controller ~]# cat /etc/redhat-release
CentOS Linux release 7.7.1908 (Core)
安装squid
yum install squid -y
修改配置文件
[root@controller ~]# cat /etc/squid/squid.conf
http_port 3128
cache_mem 64 MB
maximum_object_size 4 MB
cache_dir ufs /var/spool/squid 100 16 256
access_log /var/log/squid/access.log
acl localnet src xxxx.xxxx.xxxx.xxx/24
http_access allow all
启动服务
systemctl start squid
配置不能上网服务器
[root@localhost ~]# vi /etc/yum.conf
在[main]下增加
proxy=http://yumproxyIP:3128
此时这个机器就可以使用yum代理安装包