首先编译python3.6.4环境:
wget https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tgz
tar zxvf Python-3.6.4.tgz
cd Python-3.6.4
wget https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tgz
tar zxvf Python-3.6.4.tgz
cd Python-3.6.4
./configure --prefix=/usr/local/python-3.6.4
make
make install
echo 'export PATH=$PATH:/usr/local/python-3.6.4/bin' >> /etc/profile
. /etc/profile
(至此python3.6.4就搭建好了)
然后:
pip3.6 install asyncio
git clone https://github.com/v3aqb/shadowsocks_aio
cd shadowsocks_aio
python3.6 setup.py install
nano config.yaml
(config.yaml的内容为:
servers:
- ss://aes-128-cfb:my-password@0.0.0.0:7138
- ss://aes-256-cfb:my-password2@0.0.0.0:7139
log_level: 20 )
python3.6 -m shadowsocks_aio -c config.yaml
不过命令:python3.6 -m shadowsocks_aio -c config.yaml是运行在前台的,容易退出,
我试图用systemd来使得它运行在后台,但失败了,所以可以用daemonize来使得它运行在后台:
daemonize -c . /usr/local/python-3.6.4/bin/python3.6 -m shadowsocks_aio -c config.yaml
然后,操作如下,让shadowsocks_aio随vps的启动而自动启动:
nano /etc/init.d/ss_aio
其内容为:
#!/bin/bash
cd /root/shadowsocks_aio && daemonize -c . /usr/local/python-3.6.4/bin/python3.6 -m shadowsocks_aio -c config.yaml
chmod 755 /etc/init.d/ss_aio
update-rc.d ss_aio defaults
如果是centos,则chkconfig ss_aio on
上面的config.yaml文件表明创建了2个ss账号:
一个账号是-加密方式为aes-128-cfb,密码为my-password,地址为服务器的ip地址,端口为7138
另一个账号是-加密方式为aes-256-cfb,密码为my-password2,地址为服务器的ip地址,端口为7139
至于客户端,通用各平台的客户端程序。
项目地址:https://github.com/v3aqb/shadowsocks_aio
为防止程序作者删除源码,我特意fork了一份:
https://github.com/luckypoem/shadowsocks_aio
No comments:
Post a Comment