CentOS 中设置系统级代理
系统全局代理
如果需要为某个用户设置一个系统级的代理,可以在
vim ~/.bash_profile
最后加入:
export http_proxy="http://username:password@proxy_ip:port"
export https_proxy="https://username:password@proxy_ip:port"
使配置文件生效:
source /etc/profile
上面的设置只对某个用户生效.
如果要对所有系统用户生效:
vim /etc/profile
最后加入:
export http_proxy="http://username:password@proxy_ip:port"
export https_proxy="https://username:password@proxy_ip:port"
YUM代理设置
vim /etc/yum.conf
最后加入:
# Proxy
proxy=http://username:password@proxy_ip:port/
也可以使用proxy_username
和proxy_password
来配置代理的用户名和密码
这样的配置完成后,所有的用户在使用yum时,都会使用代理,可以说是全局代理。
如果需要为单独的用户配置代理,可以在用户的~/.bash_profile
中设置。
Wget的代理设置
vim /etc/wgetrc
最后加入:
# Proxy
http_proxy=http://username:password@proxy_ip:port/
ftp_proxy=http://username:password@proxy_ip:port/