how to use proxy on centos7

  1. system

    edit /etc/profile, like this:

    1
    2
    3
    4
    5
    vi /etc/profile
    all_proxy=socks5://username:password@ip:port
    no_proxy=127.0.0.1,10.0.0.0/8,172.0.0.0/8,192.0.0.0/8
    export all_proxy no_proxy
    source /etc/profile
    
  2. docker

    edit /usr/lib/systemd/system/docker.service, like this:

    1
    2
    3
    4
    5
    vi /usr/lib/systemd/system/docker.service
    [Service]
    Environment=HTTP_PROXY=socks5://username:password@ip:port
    Environment=NO_PROXY=127.0.0.1,10.0.0.0/8,172.0.0.0/8,192.0.0.0/8
    systemctl daemon-reload && systemctl restart docker
    

    now, you can smoothly install kubernetes in china.

  3. yum

    edit /etc/yum.conf, like this:

    1
    2
    3
    4
    5
    vi /etc/yum.conf
    [main]
    proxy=socks5://ip:port
    proxy_username=user
    proxy_password=password