Alpine 安装、运行: shadowsocks-libev

安装 🔗︎

1
2
apk --no-cache add --repository http://mirrors.cloud.tencent.com/alpine/edge/main libsodium
apk --no-cache add --repository http://mirrors.cloud.tencent.com/alpine/edge/testing shadowsocks-libev


运行 🔗︎

vi /etc/ss-srv.json

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
{
	"server_port": 18072,
	"method": "chacha20-ietf-poly1305",
	"password": "qfG3d91ea8BmS",
	"ipv6_first": false,
	"fast_open": true,
	"reuse_port": false,
	"no_delay": true,
	"mode": "tcp_and_udp",
	"timeout": 600
}


vi /etc/init.d/ss-srv

 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
26
27
28
29
30
31
32
33
34
35
#!/sbin/openrc-run

name=$RC_SVCNAME
cfgfile="/etc/ss-srv.json"
command="/usr/bin/ss-server"
command_args="-c $cfgfile"
command_user="daemon"
pidfile="/run/ss-server/$RC_SVCNAME.pid"
start_stop_daemon_args="--args-for-start-stop-daemon"
command_background="yes"

depend() {
	need net
}

start_pre() {
	mkdir -p /run/ss-server /var/log/ss-server
	checkpath --directory --owner $command_user:$command_user --mode 0775 \
		/run/ss-server /var/log/ss-server
}

start() {
	ebegin "Starting $RC_SVCNAME"
	start-stop-daemon --start -b \
		--make-pidfile \
		--pidfile $pidfile \
		--exec $command \
		-- \
		$command_args
	eend $?
}

stop() {
	kill -9 $(cat $pidfile 2>&-) 2>&- || true
}


卸载方法 🔗︎

1
2
apk del libsodium shadowsocks-libev
rm -f /etc/ss-srv.json /etc/init.d/ss-srv