Skip to content

Instantly share code, notes, and snippets.

@eagleon
Last active May 7, 2016 15:59
Show Gist options
  • Save eagleon/24a473371274410c9e335394b58d229f to your computer and use it in GitHub Desktop.
Save eagleon/24a473371274410c9e335394b58d229f to your computer and use it in GitHub Desktop.
shadowsocks step by step

##shadowsocks step by step

###1.install

apt-get install python-pip
pip install shadowsocks

###2.config /etc/shadowsocks.json

{
    "server":"0.0.0.0",
    "server_port":8388,
    "local_address": "127.0.0.1",
    "local_port":1080,
    "password":"mypassword",
    "timeout":300,
    "method":"aes-256-cfb",
    "fast_open": false
}

###3.as service vim /etc/init.d/shadowsocks

#!/bin/sh

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

chmod +x /etc/init.d/shadowsocks

vim /etc/init/shadowsocks.conf

start on (runlevel [2345])
stop on (runlevel [016])

pre-start script
/etc/init.d/shadowsocks start
end script

post-stop script
/etc/init.d/shadowsocks stop
end script

添加到开机启动 update-rc.d shadowsocks defaults 好了,搞定,可以在shell中直接运行sudo service shadowsocks {start|reload|stop}来控制了!

###4.ref https://github.com/shadowsocks/shadowsocks/wiki/Shadowsocks-%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment