CentOS7配置代理

  |  
  1. 通过修改/etc/profile文件来实现

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    #打开profile文件
    vim /etc/profile

    #添加Proxy代理信息(其中username和password根据需要填写,若无则不填写)
    http_proxy = http://username:password@proxy_ip:port/
    https_proxy = http://username:password@proxy_ip:port/
    ftp_proxy = http://username:password@proxy_ip:port/
    export http_proxy
    export https_proxy
    export ftp_proxy

    #生效配置
    source /etc/profile
  2. yum代理设置

    1
    2
    3
    4
    5
    #打开yum.conf文件
    vim /etc/yum.conf

    #添加Proxy代理信息
    proxy = http://username:password@proxy_ip:port/
  3. wget代理设置

    1
    2
    3
    4
    5
    6
    #打开/wgetrc文件
    vim /etc/wgetrc

    #修改Proxy代理信息
    http_proxy=http://username:password@proxy_ip:port/
    ftp_proxy=http://username:password@proxy_ip:port/

重启服务器 reboot

文章目录