設置全局代理,方法如下:
1、在profile文件中設置相關環(huán)境變量
# vi /etc/profile
http_proxy=http://192.168.20.20:3128 # 分別指定http、https、ftp協(xié)議使用的代理服務器地址
export http_proxy
2、 source /etc/profile 生效。
修改完成后,注銷重新登錄即可.
對于 yum 的代理,還要另外設置 /etc/yum.conf 文件,添加以下代碼:
proxy=http://username:password@yourproxy:8080/
#若無密碼限制,則為以下方式
#proxy=http://yourproxy:8080/
這樣yum的操作就通過代理了