Linux下使用Shadowsocks服务

这两天重装了Linux,又不想再用GUI的SS,网上的资料都不怎么好用,自己动手折腾了一下。

安装环境

(依赖Python)

1
sudo apt-get install build-essential python-pip python-m2crypto python-dev python-gevent supervisor

然后执行:

1
sudo pip install shadowsocks 

创建config.json文件

然后找到/usr/local/lib/python2.7/dist-packages/shadowsocks路径下
新建文件:config.json,将以下代码复制其中,修改你的SS服务配置。

1
2
3
4
5
6
7
8
{
"server" : "your server IP",
"server_port" : your server port,
"password" : "your password",
"method" : "aes-256-cfb",
"local_port":1080,
"timeout":600
}

注意
如果要使用salsa20chacha20chacha20-ietf算法,请安装 libsodium(如果是aes-256-cfb则可以跳过这一部分)
编译安装:

1
2
3
4
5
apt-get install build-essential
wget https://github.com/jedisct1/libsodium/releases/download/1.0.8/libsodium-1.0.8.tar.gz
tar xf libsodium-1.0.8.tar.gz && cd libsodium-1.0.8
sudo ./configure && make -j2 && make install
ldconfig

保存之后就可以暂时启动了。
(终端路径依旧在/usr/local/lib/python2.7/dist-packages/shadowsocks下)

1
python ./local.py -c ./config.json 


这样才算运行成功。

在Chrome中添加插件(SwitchyOmega)配置后运行如下:(SS代理)

(后面附上SwitchyOmega配置)

不过每次启动都要这么麻烦翻目录和敲命令,挺烦。

将SS服务设置开机启动

1
sudo gedit /etc/rc.local

该文件初始内容为:

1
2
#!/bin/sh -e
exit 0

我们需要把启动SS服务的命令写上去(脚本和配置文件一定要是绝对路径)

1
2
3
#!/bin/sh -e
python /usr/local/lib/python2.7/dist-packages/shadowsocks/local.py -c /usr/local/lib/python2.7/dist-packages/shadowsocks/config.json
exit 0

保存后即可,重启系统之后就会自动启动SS服务了

SwitchyOmega设置


gfwlist项目已经迁移到了github:gfwlist
Auto Switch规则列表:
https://raw.githubusercontent.com/gfwlist/gfwlist/master/gfwlist.txt

全文完,若有不足之处请评论指正。

微信扫描二维码,关注我的公众号。

本文标题:Linux下使用Shadowsocks服务
文章作者:查利鹏
发布时间:2015年08月26日 17时31分
本文字数:本文一共有625字
原始链接:https://imzlp.com/posts/23429/
许可协议: CC BY-NC-SA 4.0
文章禁止全文转载,摘要转发请保留原文链接及作者信息,谢谢!
您的捐赠将鼓励我继续创作!