CentOS 7 安装 shadowsocks libev 客户端

installation

download yum repo on Fedora Copr and put it inside /etc/yum.repos.d/. The release Epel is for RHEL and its derivatives.

Then, install shadowsocks-libev via dnf:

su -c 'dnf update'
su -c 'dnf install shadowsocks-libev'

config

shadowsocks-libev 默认读取位于 /etc/shadowsocks-libev/config.json 的配置文件,我们可以根据需要参考以下配置文件进行修改:

{
    "server": "example.zzz.buzz",
    "server_port": 10443,
    "local_port": 1080,
    "password": "zzz.buzz",
    "method": "aes-256-cfb",
    "mode": "tcp_and_udp",
    "timeout": 600
}

"server": 必填,填入要连接的 shadowsocks 服务器域名或 IP。

"server_port": 必填,填入服务器上 shadowsocks 所监听的端口。

"local_port": 必填,填入本地 shadowsocks 客户端 SOCKS5 代理要监听的端口。

"password": 必填,密码,需与 shadowsocks 服务器端配置一致。

"method": 必填,加密方法,需与 shadowsocks 服务器端配置一致。

"mode": 选填,默认 "tcp_only"。

shadowsocks 所要监听的协议,可填 "tcp_only", "udp_only" 和 "tcp_and_udp"。
填入 "tcp_and_udp" 相当于命令行上提供 -u 参数;填入 "udp_only" 相当于命令行上提供 -U 参数。

"timeout": 选填,不活动连接的保持时间。

默认 60 秒,设置较长时间有助于保持 HTTP 长连接等。设置时间过长则会导致不必要地占用过多 shadowsocks 服务器资源。

对于配置客户端,完成以上几项配置就足够了。

如果想要变更默认的配置文件,或者提供其他命令行参数,我们可以修改 /etc/sysconfig/shadowsocks-libev:

# Configuration file
CONFFILE="/etc/shadowsocks-libev/config.json"

# Extra command line arguments
DAEMON_ARGS="-u"

其中 CONFFILE 指定了 shadowsocks-libev 所读取的配置文件;DAEMON_ARGS 则指定了额外的命令行参数,此处的 "-u" 表示启用 UDP 协议。

需要注意的是,命令行参数 DAEMON_ARGS 比配置文件 CONFFILE 中指定的选项优先级要更高一些。

start

systemctl enable --now shadowsocks-libev-local

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注