yum代理

背景:

有时候别人分配的机器只有一台可以连接公网,其它的都出不去,又要使用yum,

则可以在能连接到公网的机器上面配置一个http代理,然后其它机器在/etc/yum.conf里面添加:

proxy=http://192.168.51.38:5050,这句

之后就是这样:

[main]
proxy=http://192.168.51.38:5050
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=5
bugtracker_url=http://bugs.centos.org/set_project.php?project_id=16&ref=http://bugs.centos.org/bug_report_page.php?category=yum

distroverpkg=centos-release



代理可以使用nginx,配置如下:

http {
    include       mime.types;
    default_type  application/octet-stream;


    resolver 114.114.114.114;
    sendfile        on;
    keepalive_timeout  65;


    log_format  main '$msec $request_time $status [$time_local] $remote_addr "$request_method $scheme://$host$request_uri $server_protocol" '
                     '$body_bytes_sent "$upstream_addr" $upstream_cache_status/$upstream_status $http_referer "$http_user_agent" '
                     '$sent_http_content_type $http_range';
    access_log  logs/access.log  main;


    server {
        listen       192.168.51.38:5050;
        server_name  localhost;


        access_log  logs/nginx-proxy_access.log  main;


        location / {
                 proxy_pass http://$http_host$request_uri;


                 allow 192.168.0.0/16;
                 deny all;
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }


    }
}


猜你喜欢

转载自blog.csdn.net/xiaoyilong2007101095/article/details/80856838
yum