搭建 ss 服务器

1
2
3
4
5
6
7
8
9
10
11
sudo apt update
#sudo apt install gcc
#sudo apt install python3-pip
#sudo apt install build-essential
#sudo apt install openssl
#sudo apt install libssl-dev

#pip3 install gevent
#pip3 install shadowsocks

sudo apt install shadowsocks

配置文件

1
sudo vi /etc/shadowsocks/config.json

配置文件内容:

1
2
3
4
5
6
7
8
9
10
11
12
13
{
"server":"0.0.0.0",
"server_port":8388,
"local_address": "127.0.0.1",
"local_port":1080,
"password":"D2qtfeXlvz5t+SC",
"timeout":300,
"method":"aes-256-cfb",
"fast_open": false,
"workers": 1,
"prefer_ipv6": false
}

启动

1
sudo ssserver -c /etc/shadowsocks/config.json -d start

服务自启动

1
2
sudo vi /etc/systemd/system/shadowsocks.service
sudo chmod 755 /etc/systemd/system/shadowsocks.service

shadowsocks.service 文件内容如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
[Unit]
Description=Shadowsocks
After=network.target

[Service]
Type=forking
PIDFile=/run/shadowsocks/server.pid
PermissionsStartOnly=true
ExecStartPre=/bin/mkdir -p /run/shadowsocks
ExecStartPre=/bin/chown root:root /run/shadowsocks
ExecStart=/usr/local/bin/ssserver --pid-file /var/run/shadowsocks/server.pid -c /etc/shadowsocks/config.json -d start
Restart=on-abort
User=root
Group=root
UMask=0027

[Install]
WantedBy=multi-user.target

服务器选择

可以选择在 aws 或 vultr 购买主机,vultr 美国区主机最低 2.5$ 每个月。