zoukankan      html  css  js  c++  java
  • Linux服务器配置上网代理squid

    使用公网的服务器上安装代理

    1、安装部署squid

    yum install squid
    cd /etc/squid/
    备份文件 cp squid.conf squid.conf_bak 备份文件
    修改 把http_access deny all修改为http_access allow all
    

    2、启动squid

    squid -k parse
    squid -z
    service squid start
    

    3、查看squid服务

    netstat -tupln | grep squid

    4、配置yum使用离线代理

    export http_proxy="http://192.168.1.3:3128"   ##配置临时代理地址(重新登录失效)
    vi /etc/yum.conf
    增加:proxy=http://192.168.1.3:3128
    

    5、全局离线代理设置

    vim ~/.bashrc
    export http_proxy="http://10.60.1.94:3128"
    export https_proxy="http://10.60.1.94:3128"
    export ftp_proxy=$http_proxy
    

    6、docker pull使用代理

    方法一:编辑 /usr/lib/systemd/system/docker.service
    [Service]下增加:Environment="HTTP_PROXY=10.60.1.94:3128" "HTTPS_PROXY=http://10.60.1.94:3128"

    Type=notify
    # the default is not to use systemd for cgroups because the delegate issues still
    # exists and systemd currently does not support the cgroup feature set required
    # for containers run by docker
    Environment="HTTP_PROXY=10.60.1.94:3128" "HTTPS_PROXY=http://10.60.1.94:3128"
    ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
    ExecReload=/bin/kill -s HUP $MAINPID
    TimeoutSec=0
    RestartSec=2
    Restart=always
    
    systemctl daemon-reload
    systemctl restart docker
    

    方法二:配置/etc/systemd/system/docker.service.d/

    #http
    vim /etc/systemd/system/docker.service.d/http-proxy.conf
    [Service]
    Environment="HTTP_PROXY=http://proxy.example.com:80/"
    
    #https
    vim /etc/systemd/system/docker.service.d/https-proxy.conf
    [Service]
    Environment="HTTPS_PROXY=https://proxy.example.com:443/"
    
    --------------------------------------------------------- 恐惧是因为努力的还不够,加油 ~~---------------------------------------------
  • 相关阅读:
    2020.4.21 考试T1 HDU 5729
    BZOJ 4198: [Noi2015]荷马史诗
    BZOJ 1052: [HAOI2007]覆盖问题
    BZOJ 1087: [SCOI2005]互不侵犯King
    BZOJ 4466 线性函数
    Linux如何挂载U盘
    集中式日志分析平台
    ELK5.2+kafka+zookeeper+filebeat集群部署
    浅析ES的_source、_all、store、index
    IndexOf、LastIndexOf、Substring的用法
  • 原文地址:https://www.cnblogs.com/zhaobowen/p/13369366.html
Copyright © 2011-2022 走看看