搭建SSR服务器

安装python

1. 服务安装

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
# 1. 
wget --no-check-certificate -O shadowsocks-all.sh https://raw.githubusercontent.com/teddysun/shadowsocks_install/master/shadowsocks-all.sh

# 2.
chmod +x shadowsocks-all.sh

# 3.
./shadowsocks-all.sh 2>&1 | tee shadowsocks-all.log

# 4. 卸载
./shadowsocks-all.sh uninstall

# 进入安装环节后,按照提示输入配置
# Which Shadowsocks server you'd select 处选择 SHadowssocksR
# stream cipher 处建议选择 chacha20-ietf
# protocol 处建议选择 auth_sha1_v4
# obfs 处建议选择 http_simple
# 安装完成后出现的遗传SSR连接字符串,便可以用在SSR客户端上

# 如果出现failed to install python,则打开配置文件
vim ./shadowsocks-all.sh
# 将yum_depends和apt_depends里的python字样修改为python3(大约再563行~575行之间),再重新执行安装
yum_depends=(
unzip gzip openssl openssl-devel gcc python3 python3-devel python3-setuptools pcre pcre-devel libtool l ibevent
autoconf automake make curl curl-devel zlib-devel perl perl-devel cpio expat-devel gettext-devel
libev-devel c-ares-devel git qrencode
)

apt_depends=(
gettext build-essential unzip gzip python3 python3-dev python3-setuptools curl openssl libssl-dev
autoconf automake libtool gcc make perl cpio libpcre3 libpcre3-dev zlib1g-dev libev-dev libc-ares-dev g it qrencode
)

###!!!大多数VPS已经有加速配置,额外安装加速脚本可能会导致系统损坏
###!!!如果速度足够的话,就不必要自行安装加速脚本了

2. 服务命令

启动,停止,重启,查看状态。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# Shadowsocks-Python 版:
/etc/init.d/shadowsocks-python start | stop | restart | status

# ShadowsocksR 版:
/etc/init.d/shadowsocks-r start | stop | restart | status

# Shadowsocks-Go 版:
/etc/init.d/shadowsocks-go start | stop | restart | status

# Shadowsocks-libev 版:
/etc/init.d/shadowsocks-libev start | stop | restart | status

# 如果出现:/usr/bin/env: ‘python’: No such file or directory,大多数因为python软连接没有建立
# 需要正确安装python并且建立软连接

# 开放服务端口访问(17886是安装时候的默认端口)
firewall-cmd --zone=public --add-port=17886/tcp --permanent
# 重启防火墙
firewall-cmd --reload