登录 |  注册 |  繁體中文


Linux系统设置全局代理(http代理,socks代理)

分类: 服务器相关 颜色:橙色 默认  字号: 阅读(171) | 评论(0)

临时

export http_proxy=http://ip:port

export https_proxy=http://ip:port

永久

vim /etc/profile

export http_proxy=http://ip:port

export https_proxy=http://ip:port

source /etc/profile

代理变量的配置

针对上面变量的设置方法:

1、在/etc/profile文件

2、在~/.bashrc

3、在~/.zshrc

4、在/etc/profile.d/文件夹下新建一个文件xxx.sh

写入如下配置:

export proxy="http://192.168.5.14:8118"
export http_proxy=$proxy
export https_proxy=$proxy
export ftp_proxy=$proxy
export no_proxy="localhost, 127.0.0.1, ::1"

而对于要取消设置可以使用如下命令,其实也就是取消环境变量的设置:

unset http_proxy
unset https_proxy
unset ftp_proxy
unset no_proxy

针对yum配置走代理:

经过测试其实只要设置上面的变量之后已经可以走代理了,但如果要单独设置,可以设置如下文件的变量:

echo "proxy=http://127.0.0.1:8080/" >> /etc/yum.conf

 




姓 名: *
邮 箱:
内 容: *
验证码: 点击刷新 *   

回到顶部