让终端走代理的几种方法

来源:互联网 发布:易视网远程监控软件 编辑:程序博客网 时间:2024/06/05 10:21

1.在终端中直接运行命令(只在当前终端有效)

  export http_proxy=http://proxyAddress:port 

比如:  

   export http_proxy=http_proxy://wanghonghu:vx\&tx@10.2.5.22:31281
   export https_proxy=https_proxy://wanghonghu:vx\&tx@10.2.5.22:31281
   export ftp_proxy=ftp_proxy://wanghonghu:vx\&tx@10.2.5.22:31281

2.把代理服务器地址写入shell配置文件 .bashrc或者 .zshrc,直接在.bashrc或者 .zshrc中添加下面两句(把代理服务器永久保存,下次可以直接使用)

   export http_proxy="http://localhost:port"

 export https_proxy="http://localhost:port"

比如:

 export HTTP_PROXY=http://10.2.5.22:808

  export HTTPS_PROXY=https://10.2.5.22:808

  然后ESC,:wq后,在终端,或者另起一个终端运行:sources ~/.bashrc

3.改相应工具的配置:

  sudo vim /etc/apt/apt.conf

 在文件末尾添加下面这句:

 Acquire::http::Proxy "http://proxyAddress:port"

  之后保存apt.conf即可。

原创粉丝点击