本文虽然是以ubutu作为实验环境,但是本教程通用于其他Linux环境,例如centos,redhat(运行命令时只需要去掉sudo)。
1、更新系统
sudo apt-get update
2、安装pip3
sudo apt install python3-pip
3、安装 shadowsocks
sudo pip3 install https://github.com/shadowsocks/shadowsocks/archive/master.zip
4、查看Shadowsocks版本:
sudo ssserver --version
5、新建配置文件
sudo mkdir /etc/shadowsocks sudo vim /etc/shadowsocks/shadowsocks.json
6、添加配置信息多用户
{ "server":"::", "local_address":"127.0.0.1", "local_port":1080, "port_password":{ "8888":"test8888", "9999":"test9999" }, "timeout":300, "method":"aes-256-cfb", "fast_open":false }
或者添加单用户信息
{ "server":"::", "server_port":8388, "local_address": "127.0.0.1", "local_port":1080, "password":"123456789", "timeout":300, "method":"aes-256-cfb", "fast_open": false }
说明: server:Shadowsocks服务器地址 server_port:Shadowsocks服务器端口 local_address: 本地IP local_port:本地端口 password:Shadowsocks连接密码 timeout:等待超时时间 method:加密方式 workers: 工作线程数 fast_open: true或false
7、配置自启动
1.新建启动脚本文件/etc/systemd/system/shadowsocks.service
sudo vim /etc/systemd/system/shadowsocks.service
内容如下(注意:ExecStart的值需要通过命令查找ssserver安装目录所得):
[Unit] Description=Shadowsocks [Service] TimeoutStartSec=0 ExecStart=/usr/local/bin/ssserver -c /etc/shadowsocks/shadowsocks.json [Install] WantedBy=multi-user.target
2.启动Shadowsocks客户端
sudo systemctl enable shadowsocks.service sudo systemctl start shadowsocks.service sudo systemctl status shadowsocks.service
至此,Shadowsocks已配置完成。您可以在本地安装客户端来链接上述的代理。