Linux 系统终端代理的设置方法

A:假如校园网内的代理服务器为 192.168.0.1:3128,那么在终端设置代理设置,在文件。bash_profile(在root目录下)文件中添加:

    //----------------------
    http_proxy=192.168.0.1:3128
    ftp_proxy=192.168.0.1:3128
    export http_proxy
    export ftp_proxy
    //----------------------

   然后执行

    source .bash_profile

  查看一下是否设置成功

    [root@localhost ~]# echo $http_proxy
    192.168.0.1:3128
    [root@localhost ~]#

  测试一下是否成功,使用wget这个下载工具测试。

    [root@localhost ~]# wget http://mdsx.wxedu.net/teacher/lulp/pic/04.mp3
    --10:06:01-- http://mdsx.wxedu.net/teacher/lulp/pic/04.mp3
    =〉 `04.mp3’

  正在连接 192.168.0.1:3128…… 已连接。

  已发出 Proxy 请求,正在等待回应…… 200 OK,长度:

    4,701,622 [audio/mpeg]
    100%[============〉] 4,701,622 635.27K/s ETA 00:00
    10:06:09 (584.74 KB/s) - `04.mp3’ saved [4,701,622/4,701,622]

  注意:其中代理服务器192.168.0.1要根据你的局域网具体情况而设置,从上面可以看到,测试成功。