1、依赖安装
apt-get update
apt-get install git wget python-setuptools -y
apt-get install python-pip
pip install cymysql
2、libsodium 安装
apt-get install build-essential -y
wget https://github.com/jedisct1/libsodium/releases/download/1.0.16/libsodium-1.0.16.tar.gz
tar xf libsodium-1.0.16.tar.gz && cd libsodium-1.0.16
./configure && make -j2 && make install
echo /usr/local/lib > /etc/ld.so.conf.d/usr_local_lib.conf
ldconfig
cd ../ && rm -rf libsodium*
3、下载源代码并安装依赖
git clone -b manyuser https://github.com/Anankke/shadowsocks.git
cd shadowsocks
pip install -r requirements.txt
4、配置文件
cp apiconfig.py userapiconfig.py
cp config.json user-config.json
vi userapiconfig.py
5、运行SSR
python server.py 用于调试的
./run.sh 无日志后台运行
./logrun.sh 有日志后台运行
6、开机启动
假设你的shadowsocks是安装在root目录下,可以这样:vi /etc/rc.local
加入一条:sh /root/shadowsocks/run.sh
然后:chmod +x /etc/rc.local
Debian 9开机启动 https://sixu.life/debian-9-etc-rc-local.html
7、使用Supervisor守护进程启动ssr
# 安装
apt-get install supervisor -y
# 写入配置
vi /etc/supervisor/conf.d/ssr.conf
# 写入以下内容
[program:ssr]
command=python /root/shadowsocks/server.py
autorestart=true
autostart=true
user=root
# 重启Supervisor服务。
/etc/init.d/supervisor restart
# 重启 ssr
supervisorctl restart ssr
# 查看Supervisor服务运行状态。
supervisorctl status
# 如果遇到问题,可以检查日志:
supervisorctl tail -f ssr stderr
# 如果使用supervisor进程守护,需要修改文件vi /etc/default/supervisor,添加一行:
ulimit -n 1024000
8、加速
Debian OpenVZ 魔改 BBR:https://sixu.life/debian-openvz-magic-change-bbr.html
Debian centos bbr加速:https://sixu.life/the-acceleration-effect-of-bbr-is-obvious.html
解决报错:ImportError: No module named cymysql
```
#debian
apt-get install python-pip
pip install cymysql
#centos
yum install -y python-setuptools && easy_install pip && pip install cymysql
```
新的:
git clone -b manyuser https://github.com/Anankke/shadowsocks.git