shadowsocks - ss服务安装 以及 v2ray服务安装

1 购买云主机

购买地址:(选择centos即可)
https://www.vultr.com/register/
建议: 选择硅谷服务器,ip比较好用
购买后deploy完成(大胆deploy,一次0.01$,它收费是按照使用时长收费的)

2 ssh登入主机然后安装ss服务端

2.0 安装ss-server, 以及obfs或者v2ray作为混淆

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
36
37
38
39
40
41
42
43
# 关闭防火墙
systemctl status firewalld.service
systemctl stop firewalld.service
systemctl disable firewalld.service

# 安装ss-server
## mac: brew install shadowsocks-libevs

cd /etc/yum.repos.d/
yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
curl -O https://copr.fedorainfracloud.org/coprs/librehat/shadowsocks/repo/epel-7/librehat-shadowsocks-epel-7.repo
yum install -y shadowsocks-libev
ss-server -h # 之后应该能看到提示信息

# 安装simple-obfs(已经不再维护)
yum install zlib-devel openssl-devel git autoconf automake asciidoc libtool xmlto libev-devel -y
git clone https://github.com/shadowsocks/simple-obfs.git
cd simple-obfs
git submodule update --init --recursive
./autogen.sh
./configure && make
make install
cd .. && obfs-server # 应该能看到提示信息

# 安装v2ray-plugin
# v2ray需要域名支持,所以重新考虑吧




### 2.1 配置ss-server的配置文件:
```sh
[root@vultrguest simple-obfs]# cat /etc/shadowsocks-libev/config.json
{
"server":["[::0]","0.0.0.0"],
"server_port": 8388,
"password":"0000",
"timeout":300,
"plugin": "obfs-server",
"plugin_opts": "obfs=tls;obfs-host=iosapps.itunes.apple.com",
"method":"aes-256-gcm",
"fast_open":false
}

2.2 将ss-server启动配置成服务

1
2
3
4
5
6
7
8
9
10
11
# 创建文件: /etc/systemd/system/shadowsocks.service,其内容如下
[Unit]
Description=Shadowsocks Server
After=network.target

[Service]
ExecStart=/usr/bin/ss-server -c /etc/shadowsocks-libev/config.json -u
Restart=on-abort

[Install]
WantedBy=multi-user.target

之后启动服务:

1
2
3
systemctl enable shadowsocks.service
systemctl start shadowsocks.service
systemctl status shadowsocks.service

应该能看到如下结果:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[root@nash5 ~]# systemctl status shadowsocks.service
● shadowsocks.service - LSB: Fast tunnel proxy that helps you bypass firewalls
Loaded: loaded (/etc/rc.d/init.d/shadowsocks; generated)
Active: active (running) since Mon 2021-09-27 01:53:36 UTC; 1 weeks 4 days ago
Docs: man:systemd-sysv-generator(8)
Process: 61718 ExecStop=/etc/rc.d/init.d/shadowsocks stop (code=exited, status=0/SUCCESS)
Process: 61720 ExecStart=/etc/rc.d/init.d/shadowsocks start (code=exited, status=0/SUCCESS)
Tasks: 2 (limit: 5048)
Memory: 19.0M
CGroup: /system.slice/shadowsocks.service
├─61722 /usr/local/bin/ss-server -v -c /etc/shadowsocks-libev/config.json -f /var/run/shadowsocks-libev.pid
└─61723 obfs-server

Oct 08 05:43:26 nash5 /usr/local/bin/ss-server[61722]: close a connection to remote, 4 opened remote connections
Oct 08 05:43:26 nash5 /usr/local/bin/ss-server[61722]: close a connection from client, 4 opened client connections

3 win 客户端方面

3.1 修改主机host

3.3 - end -

来了

4 linux&mac客户端

4.0.0 linux 安装simple-obfs(已经不再维护)

yum install zlib-devel openssl-devel git autoconf automake asciidoc libtool xmlto libev-devel -y
git clone https://github.com/shadowsocks/simple-obfs.git
cd simple-obfs
git submodule update –init –recursive
./autogen.sh
./configure && make
make install
cd .. && obfs-server # 应该能看到提示信息

linux将ss-local做成服务:

1
2
3
4
5
6
7
8
9
10
11
12
13
~ >>> cat /usr/lib/systemd/system/ss-local.service                                                                                              [130]
[Unit]
Description=Shadowsocks-Libev Client Service
After=network.target

[Service]
Type=simple
User=nobody
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
ExecStart=/usr/local/bin/ss-local -c /etc/shadowsocks/ld.json --plugin obfs-local --plugin-opts "obfs=tls;obfs-host=cn.bing.com;fast-open=true;"

[Install]
WantedBy=multi-user.target

编译过程不需要了,直接

1
2
3
4
5
6
brew install simple-obfs
brew install shadowsocks-libev

# 参照linux的写法:
/opt/homebrew/opt/shadowsocks-libev里的将plist文件改为:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>homebrew.mxcl.shadowsocks-libev</string>
<key>ProgramArguments</key>
<array>
<string>/opt/homebrew/opt/shadowsocks-libev/bin/ss-local</string>
<string>-c</string>
<string>/opt/homebrew/etc/shadowsocks-libev.json</string>
<string>plugin</string>
<string>obfs-local</string>
<string>plugin-opts</string>
<string>obfs=tls;obfs-host=cn.bing.com;fast-open=true;</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>

可以看出对应的config文件,修改为如下:
其中的method一定要和server的方法对齐

1
2
3
4
5
6
7
8
9
10
ldxy@ldxydeMacBook-Pro softwares % cat /opt/homebrew/etc/shadowsocks-libev.json
{
"server":"你的ip",
"server_port":8388,
"local_port":1080,
"password":"你的秘密",
"timeout":600,
"method":"aes-256-gcm"
}

修改完成以后启动运行调试即可:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
brew services list
cat ~/Library/LaunchAgents/homebrew.mxcl.shadowsocks-libev.plist
brew services start shadowsocks-libev
ps -ef | grep ss-local
````

# V2ray配置安装
## 1 购买域名
参考:
[https://www.clloz.com/programming/assorted/2021/11/15/vps-2021/](https://www.clloz.com/programming/assorted/2021/11/15/vps-2021/)

## 2 配置v2ray
参考: [https://iyideng.vip/black-technology/cgfw/vmess-v2ray-server-building-and-using-tutorial.html](https://iyideng.vip/black-technology/cgfw/vmess-v2ray-server-building-and-using-tutorial.html)

值得注意的一点是,当你本地ping不通你的域名,你需要修改dns服务器,使得你能够获得你的域名:
```sh
sudo vim /etc/resolv.conf
# 添加以下内容
nameserver 202.114.0.131
nameserver 202.114.0.242
nameserver 114.114.114.114

nslookup 你的域名