Ubuntu 16.04 install shadowsocks

Ubuntu 16.04 install shadowsocks

1.1更新apt

apt update &&apt upgrade

##1.2安装python pip

apt install python-pip python-dev

##1.3升级pip到9.0版本

pip install -U pip

###如果pip报错

Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/lib/python2.7/dist-packages/pip/__main__.py", line 19, in 
    sys.exit(pip.main())
  File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 215, in main
    locale.setlocale(locale.LC_ALL, '')
  File "/usr/lib/python2.7/locale.py", line 581, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting

则需要设置locale环境变量

export LC_ALL=C

如果还报错则需要安装

apt install libssl-dev -y
apt install libffi-dev

##2.1安装shdowsocks

pip install shadowsocks

添加shadowsocks 配置文件

mkdir /config &&
mkdir /config/shadowsocks

echo "{\"server\":\"服务器IP\",\"server_port\":端口号,\"password\":\"密码\",\"timeout\":300,\"method\":\"aes-256-cfb\",\"fast_open\":true,\"workers\":1}" > /config/shadowsocks/shadowsocks.json

添加自启,将

sudo ssserver -c /config/shadowsocks/shadowsocks.json -d start

添加到 /etc/rc.local exit 0 的前面