Shadowsocket5 服务搭建

容器安装

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
# 开放 iptables 端口
iptables -P FORWARD ACCEPT

# 关闭 swap
swapoff -a
sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab

# 关闭 selinux
sed -ri 's#(SELINUX=).*#\1disabled#' /etc/selinux/config
setenforce 0

# 关闭防火墙
systemctl disable firewalld && systemctl stop firewalld

# 安装 docker 源
curl -o /etc/yum.repos.d/docker-ce.repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

# 下载docker并设置开机启动
yum install -y docker-ce-cli-19.03.9-3.el7 docker-ce-19.03.9-3.el7
systemctl enable docker && systemctl start docker

# 拉取镜像并启动容器
docker pull shadowsocks/shadowsocks-libev:latest

# -k 设置密码, -m 设置加密方式
docker run -d --restart=always -p 8388:8388 -p 8388:8388/udp shadowsocks/shadowsocks-libev ss-server -p 8388 -k Kk9nxyGweDXzOM1WhJ9MftjWbSg -m aes-256-gcm

pip 直接安装

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
# 安装 epel 源
yum update && yum -y install epel-release

# 安装python-pip
yum install python-pip

# 升级pip到最新版本
pip install --upgrade pip

# 安装shadowsocks
pip install shadowsocks

# 创建shadowsocks配置文件,内容如下
# - 配置文件路径:/etc/shadowsocks.json。

{
"server":"0.0.0.0",
"server_port":13579,
"local_address": "127.0.0.1",
"local_port":1080,
"password":"gogen123",
"timeout":300,
"method":"aes-256-cfb",
"fast_open": false
}

# 启动服务
ssserver -c /etc/shadowsocks.json -d start