Debian 9 (Stretch) 上部署 shadowsocks-libev 服务端并开启混淆

就个人看法来说,如果操作系统采用 Debian,无论是作为客户端还是服务端,使用 shadowsocks-libev 都是一种非常舒适流畅的体验。

注:以下的所有命令,都是针对 Debian 9 Stretch,并在root用户下执行的。

安装

添加 stretch-backports

sh -c 'printf "deb http://deb.debian.org/debian stretch-backports main" > /etc/apt/sources.list.d/stretch-backports.list'

apt update

安装 shadowsocks-libevsimple-obfs

apt -t stretch-backports install shadowsocks-libev
apt -t stretch-backports install simple-obfs

配置

编辑配置文件:

vim /etc/shadowsocks-libev/config-obfs.json
/etc/shadowsocks-libev/config-obfs.json
1
2
3
4
5
6
7
8
9
10
11
12
{
"server":["[::0]","0.0.0.0"],
"server_port":端口,
"local_port":1080,
"password":"密码",
"timeout":60,
"method":"aes-256-gcm",
"mode":"tcp_and_udp",
"fast_open":false,
"plugin":"obfs-server",
"plugin_opts":"obfs=http"
}

设置指定使用哪个配置文件,这里更改了文件中CONFFILE的值:

vim /etc/default/shadowsocks-libev
/etc/default/shadowsocks-libev
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# Defaults for shadowsocks initscript
# sourced by /etc/init.d/shadowsocks-libev
# installed at /etc/default/shadowsocks-libev by the maintainer scripts
#
# This is a POSIX shell fragment
#
# Note: `START', `GROUP' and `MAXFD' options are not recognized by systemd.
# Please change those settings in the corresponding systemd unit file.
# Enable during startup?
START=yes
# Configuration file
CONFFILE="/etc/shadowsocks-libev/config-obfs.json"
# Extra command line arguments
DAEMON_ARGS="-u"
# User and group to run the server as
USER=nobody
GROUP=nogroup
# Number of maximum file descriptors
MAXFD=32768

启动并检查

激活服务,以便开机自动启动:

systemctl enable shadowsocks-libev

启动服务:

systemctl start shadowsocks-libev

查看服务状态:

systemctl status shadowsocks-libev

至此,对服务端的部署配置愉快完成。

开启BBR加速,见 Enable BBR on Debian Stretch