七月 06, 2014

shadowsocks-libev ubuntu/debian 详细搭建教程

小白专用,大神无视。

shadowsocks有好几种版本,现在部署的是由madeye维护的libev的版本。主要特点就是非常省资源。具体的可去看作者写的介绍。

首先更新下系统

apt-get update
apt-get upgrade

安装编译器和git
apt-get install build-essential autoconf libtool libssl-dev git

把源码clone下来,编译安装(编译安装是最新版,用源安装不是最新版本)
git clone https://github.com/madeye/shadowsocks-libev.git
cd shadowsocks-libev
./configure && make
make install

运行shadowsocks-libev(两种方法)

**直接使用命令行参数运行

nohup /usr/local/bin/ss-server -s 0.0.0.0 -p xxxx -k xxxxxxxx -m aes-256-cfb &
-s 服务端监听的地址,服务端可填写 0.0.0.0

-p 服务端的端口。最好10000以下


-k 用于加密的密码。貌似得8位以上,总之多打点吧


-m 加密方法,推荐 "aes-256-cfb"


这样shadowsocks-libev就按照给定的参数运行了


**调用配置文件运行


建立/etc/shadowsocks.json这个配置文件(其他路径也可以,用vi命令winscp或者别的都行,推荐不懂的使用winscp,全图形化中文界面):

{
    "server":"0.0.0.0",
    "server_port":xxxx,
    "local_address": "127.0.0.1",
    "local_port":1080,
    "password":"xxxxxxxx",
    "timeout":300,
    "method":"aes-256-cfb",
    "fast_open": false,
    "workers": 1
}
这里是各个字段的意思,注意标点符号别少打或打多了。
server_port:端口号
password:密码
要求同上。

运行
nohup /usr/local/bin/ss-server -c /etc/shadowsocks.json &
这样shadowsocks-libev就调用配置文件运行了

让shadowsocks-libev开机自启动

编辑/etc/rc.local

在 exit 0 这行上边 添加 
nohup /usr/local/bin/ss-server -s 0.0.0.0 -p xxxx -k xxxxxxxx -m aes-256-cfb &
nohup /usr/local/bin/ss-server -c /etc/shadowsocks.json &
这样 shadowsocks-libev 就可以开机自启了。

在命令行增加-u可以在服务端打开udp转发。如下:
nohup /usr/local/bin/ss-server -c /etc/shadowsocks.json -u &
nohup可让程序后台运行。通常形式为
nohup command &

没有评论:

发表评论