lijiankuan
4/2/2019 - 11:47 AM

Ubuntu-18.04 Shadowsocks 配置

Shadowsocks配置方式

安装Shadowsocks

sudo apt install python-pip 
sudo apt install libsodium-dev # libsodium-dev用于chacha20-ietf-poly1305加密
sudo pip install https://github.com/shadowsocks/shadowsocks/archive/master.zip -U
  • 客户端配置文件shadowsocks.json

测试

$ tmux new -s shadowsocks
$ sslocal -c shadowsocks.json

Switch Omega

浏览器利用Switch Omega设置proxy/direct/pac模式

Privoxy

sudo apt install privoxy
sudo vim /etc/privoxy/config

config中默认监听8118端口

forward-socks5[t] / 127.0.0.1:1080 . # http/https转发到1080端口
$ vim /etc/profile # 添加以下两行

export http_proxy=http://127.0.0.1:8118
export https_proxy=http://127.0.0.1:8118
$ curl www.google.com #测试Privoxy

开机启动

$ sudo vim /lib/systemd/system/shadowsocks.service # 添加service
$ sudo systemctl start shadowsocks.service # 启动service
$ sudo systemctl enable shadowsocks.service # 设置开机启动
{  
    "server":"购买的VPN IP地址",  
    "server_port":VPN端口,  
    "local_port":1080,  
    "password":"my password",  
    "timeout":600,  
    "method":"chacha20-ietf-poly1305"  
}
[Unit]
Description=Shadowsocks Client
After=network.target

[Service]
ExecStart=/usr/local/bin/sslocal -c /etc/shadowsocks.json
Restart=on-abort

[Install]
WantedBy=multi-user.target