Ubuntu 16.04 搭建 Shadowsocks 服务

更新软件源

apt-get update

安装 PIP 环境

apt-get install python-pip

安装 shadowsocks

pip install shadowsocks

运行命令后收到错误提示

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-c9kUlu/shadowsocks/
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

按提示升级 PIP 后再次安装 shadowsocks

pip install --upgrade pip
pip install shadowsocks

再次收到错误提示

Could not import setuptools which is required to install from a source distribution.
Please install setuptools.

安装 setuptools 后再安装

apt-get install python-setuptools
pip install shadowsocks

安装成功后,直接运会命令可使用

ssserver -p 8000 -k password -m rc4-md5 -d start

也可以使用配置文件进行配置,方法创建 /etc/shadowsocks.json 文件,填入如下内容:

{
    "server":"my_server_ip",
    "server_port":8000,
    "local_address": "127.0.0.1",
    "local_port":1080,
    "password":"mypassword",
    "timeout":300,
    "method":"rc4-md5"
}

my_server_ip 填写服务器 IP,mypassword 为自设的密码,然后使用配置文件在后台运行:

ssserver -c /etc/shadowsocks.json -d start

如果要停止运行,将命令中的 start 改成 stop

最后在设备上安装 Shadowsocks 客户端并设置好就可以代理上网了。