CentOS 6 中设置系统级代理

YUM代理设置bash

 

编辑/etc/yum.conf,在最后加入dom

# Proxyide

proxy=http://username:password@proxy_ip:port/代理

 

也能够使用proxy_username和proxy_password来配置代理的用户名和密码ip

 

这样的配置完成后,全部的用户在使用yum时,都会使用代理,能够说是全局代理。get

 

 

Wget的代理设置it

 

编辑/etc/wgetrc,在最后加入io

# Proxyclass

http_proxy=http://username:password@proxy_ip:port/proxy_pass

https_proxy=https://username:password@proxy_ip:port/

ftp_proxy=http://username:password@proxy_ip:port/

 

系统全局代理

 

vi /etc/environment 

http_proxy="http://proxy.com:8000"

https_proxy="https://proxy.com:8000"

# for proxy exception

no_proxy="127.0.0.1, localhost, *.cnn.com, 192.168.1.10, domain.com:8080"


或者 vi /etc/profile.d/proxy.sh

export http_proxy="http://proxy.com:8000"

export https_proxy="https://proxy.com:8000"

# for proxy exception

export no_proxy="127.0.0.1, localhost, *.cnn.com, 192.168.1.10, domain.com:8080"



若是须要为某个用户设置一个系统级的代理,能够在~/.bash_profile中设置:

 

http_proxy="http://username:password@proxy_ip:port"

https_proxy="https://username:password@proxy_ip:port"

export http_proxy

 

上面的设置只对某个用户生效,若是要对全部系统用户生效,写在/etc/profile中就能够了。

相关文章
相关标签/搜索