CentOS 6 中設置系統級代理

YUM代理設置

 

編輯/etc/yum.conf,在最後加入

# Proxy

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

 

也可以使用proxy_username和proxy_password來配置代理的用戶名和密碼

 

這樣的配置完成後,所有的用戶在使用yum時,都會使用代理,可以說是全局代理。

 

 

Wget的代理設置

 

編輯/etc/wgetrc,在最後加入

# Proxy

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

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中就可以了。


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章