ubuntu使用shadowsocks

配置shadowsocks

  1. 安装shadowsocks

    1
    apt-get install shadowsocks
  2. 编辑配置文件

    shadowsocks.json:

    1
    2
    3
    4
    5
    6
    7
    8
    {
    "server": "{your-server}",
    "server_port": 40002,
    "local_port": 1080,
    "password": "{your-password}",
    "timeout": 600,
    "method": "aes-256-cfb"
    }
  3. 启动

    1
    sudo sslocal -c shawdowsocks.json -d start

配置代理

  1. 安装polipo

    1
    sudo apt-get install polipo
  2. 修改他的配置 文件 /etc/polipo/config:

    1
    sudo vim /etc/polipo/config
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    logSyslog = true
    logFile = /var/log/polipo/polipo.log
    proxyAddress = "0.0.0.0"
    socksParentProxy = "127.0.0.1:1080"
    socksProxyType = socks5
    chunkHighMark = 50331648
    objectHighMark = 16384
    serverMaxSlots = 64
    serverSlots = 16
    serverSlots1 = 323
  3. 重启polipo服务:

    1
    service polipo restart

    如果重启失败则手动重启, 如下

    1
    2
    3
    ps -ef |grep polipo
    kill -9 xxxxxx
    service polipo start
  4. 为终端配置http代理:

    1
    export http_proxy="http://127.0.0.1:8123/"
  5. 测试是否成功:

    1
    curl www.google.com

大功告成!

PS:

  • 重启服务器需要重新执行

    1
    2
    sslocal -c shawdowsocks.json -d start
    export http_proxy="http://127.0.0.1:8123/"
  • git 命令需要在后面跟参数

    1
    --config http.proxy=localhost:8123

    举个栗子:

    1
    git clone xxx --config http.proxy=localhost:8123
0%