阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

配置阿里yum源代理访问

69次阅读
没有评论

共计 2619 个字符,预计需要花费 7 分钟才能阅读完成。

导读 环境:网关服务器可以上网、客户端为内网,不允许上网

服务端配置 nginx 代理

server{
       listen 16666;
       server_name _;
        add_header Access-Control-Allow-Origin *;
        add_header Access-Control-Allow-Headers X-Requested-With;
        add_header Access-Control-Allow-Methods GET,POST,OPTIONS;

        location / {
            root   html;
            index  index.html index.htm;
        }

        location /centos/ {proxy_pass http://mirrors.aliyun.com/centos/;}

        location /epel/ {proxy_pass http://mirrors.aliyun.com/epel/;}

        location /mariadb/ {proxy_pass http://mirrors.ustc.edu.cn/mariadb/;}

    }

使用 yum 源的客户端配置

[root@master1 ~]# cd /etc/yum.repos.d/
[root@master1 yum.repos.d]# vim CentOS-Base.repo 
[base]
name=CentOS-$releasever - Base - 192.168.100.100:16666
failovermethod=priority
baseurl=http://192.168.100.100:16666/centos/$releasever/os/$basearch/
        http://192.168.100.100:16666/centos/$releasever/os/$basearch/
#        http://mirrors.cloud.aliyuncs.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://192.168.100.100:16666/centos/RPM-GPG-KEY-CentOS-7

#released updates 
[updates]
name=CentOS-$releasever - Updates - 192.168.100.100:16666
failovermethod=priority
baseurl=http://192.168.100.100:16666/centos/$releasever/updates/$basearch/
        http://192.168.100.100:16666/centos/$releasever/updates/$basearch/
#        http://mirrors.cloud.aliyuncs.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://192.168.100.100:16666/centos/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - 192.168.100.100:16666
failovermethod=priority
baseurl=http://192.168.100.100:16666/centos/$releasever/extras/$basearch/
        http://192.168.100.100:16666/centos/$releasever/extras/$basearch/
#        http://mirrors.cloud.aliyuncs.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://192.168.100.100:16666/centos/RPM-GPG-KEY-CentOS-7
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - 192.168.100.100:16666
failovermethod=priority
baseurl=http://192.168.100.100:16666/centos/$releasever/centosplus/$basearch/
        http://192.168.100.100:16666/centos/$releasever/centosplus/$basearch/
#        http://mirrors.cloud.aliyuncs.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://192.168.100.100:16666/centos/RPM-GPG-KEY-CentOS-7

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - 192.168.100.100:16666
failovermethod=priority
baseurl=http://192.168.100.100:16666/centos/$releasever/contrib/$basearch/
        http://192.168.100.100:16666/centos/$releasever/contrib/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://192.168.100.100:16666/centos/RPM-GPG-KEY-CentOS-7

清理 yum 缓存

yum clean all

测试

yum list

阿里云 2 核 2G 服务器 3M 带宽 61 元 1 年,有高配

腾讯云新客低至 82 元 / 年,老客户 99 元 / 年

代金券:在阿里云专用满减优惠券

正文完
星哥玩云-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2024-07-24发表,共计2619字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中