Debian & Ubuntu 上使用 shadowsocks-libev 客户端

本文最后更新于 2020 年 5 月 18 日


本文以 Debian 10 (Buster) 为例,介绍如何通过 snap 安装并使用 ss-libev 客户端,本教程同样适用于 Ubuntu 。服务端部署教程见这里

安装

安装 snapd

1
sudo apt update && sudo apt install snapd -y

安装 snap core:

1
sudo snap install core

安装 shadowsocks-libev

1
sudo snap install shadowsocks-libev

配置

编辑配置文件:

1
2
sudo mkdir -p /var/snap/shadowsocks-libev/common/etc/shadowsocks-libev
sudo vim /var/snap/shadowsocks-libev/common/etc/shadowsocks-libev/config.json
/var/snap/shadowsocks-libev/common/etc/shadowsocks-libev/config.json
1
2
3
4
5
6
7
8
9
10
{
"server":"服务器地址",
"server_port":端口,
"local_port":1080,
"password":"密码",
"timeout":60,
"method":"aes-256-gcm",
"mode":"tcp_and_udp",
"fast_open":false
}

自启

1
sudo vim /etc/systemd/system/[email protected]
/etc/systemd/system/[email protected]
1
2
3
4
5
6
7
8
9
10
11
12
[Unit]
Description=Shadowsocks-Libev Custom Client Service for %I
After=network-online.target

[Service]
Type=simple
ExecStart=/usr/bin/snap run shadowsocks-libev.ss-local -c /var/snap/shadowsocks-libev/common/etc/shadowsocks-libev/%i.json
Restart=on-failure
RestartSec=15

[Install]
WantedBy=multi-user.target

启动并检查

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

1
sudo systemctl enable shadowsocks-libev-local@config

启动服务:

1
sudo systemctl start shadowsocks-libev-local@config

查看服务状态:

1
sudo systemctl status shadowsocks-libev-local@config

至此,对客户端的配置完成,代理服务在 socks5://127.0.0.1:1080 上。


References

shadowsocks/shadowsocks-libev

Mastodon