首先安装python

apt-get install python

再下载pip

wget https://bootstrap.pypa.io/get-pip.py --no-check-certificate

或者从这里下载

wget http://img.qinyang.me/blog/get-pip.py

安装pip

root@localhost:~# python get-pip.py 
Collecting pip
Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB)
100% |################################| 1.3MB 1.2MB/s 
Collecting wheel
Downloading wheel-0.29.0-py2.py3-none-any.whl (66kB)
100% |################################| 71kB 12.8MB/s 
Installing collected packages: pip, wheel
Successfully installed pip-9.0.1 wheel-0.29.0
root@localhost:~# pip install shadowsocks
Collecting shadowsocks
Downloading shadowsocks-2.8.2.tar.gz
Building wheels for collected packages: shadowsocks
Running setup.py bdist_wheel for shadowsocks ... done
Stored in directory: /root/.cache/pip/wheels/c9/d8/ff/5425932823af361970658e9421b4d53ac50b08dcbe6fd41e5f
Successfully built shadowsocks
Installing collected packages: shadowsocks
Successfully installed shadowsocks-2.8.2

配置文件:

root@localhost:~# vi /etc/shadowsocks.json 
{
    "server":"ss.qinyang.me",
    "server_port":8388,
    "local_address": "127.0.0.1",
    "local_port":1080,
    "password":"password",
    "timeout":300,
    "method":"aes-256-cfb",
    "fast_open": false
}

配置自动启动

root@localhost:~# vi /etc/init.d/shadowsocks 
#!/bin/sh

### BEGIN INIT INFO
# Provides: OSSEC HIDS
# Required-Start: $network $remote_fs $syslog $time
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: OSSEC HIDS
### END INIT INFO

start(){
        ssserver -c /etc/shadowsocks.json -d start
}

stop(){
        ssserver -c /etc/shadowsocks.json -d stop
}

case "$1" in
start)
        start
        ;;
stop)
        stop
        ;;
reload)
        stop
        start
        ;;
*)
        echo "Usage: $0 {start|reload|stop}"
        exit 1
        ;;
esac
update-rc.d shadowsocks defaults