配置shadowsocks

搬瓦工上装了 Centos7 系统自带的一键 shadowssocks 功能就没有了, 需要我们自己安装。

安装

详情参考shadowsocks

1
2
$ apt-get install python-pip
$ pip install git+https://github.com/shadowsocks/shadowsocks.git@master

配置

创建配置文件

shadowsocks 安装完成之后, vim 创建一个配置文件/etc/shadowsocks.json

输入相关配置

1
2
3
4
5
6
7
$ vim /etc/shadowsocks.json
{
"server": "0.0.0.0",
"server_port": 8388,
"password": "a123456",
"method": "aes-256-cfb"
}

如果要配置多个端口

1
2
3
4
5
6
7
8
9
{
"server": "0.0.0.0", "port_password":
{
"8388":"a123456",
"8387":"b123456",
"8386":"c123456"
},
"method": "aes-256-cfb"
}

method: 加密方法, 可选 aes-128-cfb, aes-192-cfb, aes-256-cfb, bf-cfb, cast5-cfb, des-cfb, rc4-md5, chacha20, salsa20, rc4

server server_port: IP 和监听端口

password: 密码

配置自启动

新建启动脚本文件/etc/systemd/system/shadowsocks.service

1
$ vim /etc/systemd/system/shadowsocks.service

输入以下内容

1
2
3
4
5
6
7
[Unit]
Description=Shadowsocks
[Service]
TimeoutStartSec=0
ExecStart=/usr/bin/ssserver -c /etc/shadowsocks.json
[Install]
WantedBy=multi-user.target

执行以下命令启动 shadowsocks 服务

1
2
3
$ systemctl enable shadowsocks # 加入开机启动
$ systemctl start shadowsocks # 启动
$ systemctl restart shadowsocks # 重新启动服务

检查 shadowsocks 服务是否已成功启动

1
$ systemctl status shadowsocks -l