Linux配置ShadowSocks-R

  1. 一、环境
    1. 1、基本环境
    2. 2、下载SSR,安装git、python3
      1. 1.ssr
      2. 2.python3
      3. 3.启动SSR
  2. 二、转换HTTP代理
    1. 1.配置Polipo
    2. 2.配置浏览器
  3. 三、脚本

一、环境

1、基本环境

1.连接网络的linux
2.代理,非SS,而是SSR,否则因兼容性导致无效
3.git
4.python3

2、下载SSR,安装git、python3

1.ssr

1.下载git:

sudo apt-get install git

2.下载vim:
sudo apt-get install vim

3.下载ssr客户端:
git clone https://github.com/ssrbackup/shadowsocksr

4.配置代理:
vim config.json

这里是config.json中都文件内容
只需要将有的配置都加上就好了

{
"server": "0.0.0.0",
"server_ipv6": "::",
"server_port": 8388,
"local_address": "127.0.0.1",
"local_port": 1080,

"password": "m",
"method": "aes-128-ctr",
"protocol": "auth_aes128_md5",
"protocol_param": "",
"obfs": "tls1.2_ticket_auth_compatible",
"obfs_param": "",
"speed_limit_per_con": 0,
"speed_limit_per_user": 0,

"additional_ports" : {}, // only works under multi-user mode
"additional_ports_only" : false, // only works under multi-user mode
"timeout": 120,
"udp_timeout": 60,
"dns_ipv6": false,
"connect_verbose_info": 0,
"redirect": "",
"fast_open": false
}

2.python3

先查看python是否是3版本

python -V

如果是2.x则需要修改为3.x,否则可以直接进入3.启动ssr。

输入命令:

sudo add-apt-repository ppa:jonathonf/python-3.6
sudo apt-get update
sudo apt-get install python3.6

调整优先级

sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 2
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 150
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 100

完成后可以看看python版本

python -V

3.启动SSR

启动ssr

python ~/Document/shadowsocksr/shadowsocks/local.py -c ~/Document/shadowsocksr/config.json

成功运行:
IPv6 support
2018-12-06 11:11:05 INFO util.py:85 loading libsodium from libsodium.so.23
2018-12-06 11:11:05 INFO local.py:50 local start with protocol[auth_aes128_md5] password [NAUgcj] method [chacha20] obfs [http_post] obfs_param [tvb.com]
2018-12-06 11:11:05 INFO local.py:54 starting local at 127.0.0.1:1080
2018-12-06 11:11:05 INFO asyncdns.py:324 dns server: [('127.0.0.53', 53)]

二、转换HTTP代理

1.配置Polipo

以上完成后但是并不能连上
这里需要使用polipo转换

sudo apt-get install polipo
sudo vim /etc/polipo/config

修改内容为以下

logSyslog = false
logFile = "/var/log/polipo/polipo.log"

socksParentProxy = "127.0.0.1:1080"
socksProxyType = socks5

chunkHighMark = 50331648
objectHighMark = 16384

serverMaxSlots = 64
serverSlots = 16
serverSlots1 = 32

proxyAddress = "0.0.0.0"
proxyPort = 8123

重启polipo

/etc/init.d/polipo restart

验证代理成功

export http_proxy="http://127.0.0.1:8123/"
curl www.google.com

正常则会抓取到网页内容

2.配置浏览器

打开设置下:Network -> Network Proxy -> Method:Manual
在http和https下修改ip和端口号为:127.0.0.1:8123

打开火狐后www.google.com成功!

三、脚本

安装screen窗口管理

sudo apt-get install screen

vim脚本

#! /bin/bash
#shadowSSR.sh
screen python ~/Document/shadowsocksr/shadowsocks/local.py -c ~/Document/shadowsocksr/config.json
/etc/init.d/polipo restart

# 运行
sh ~/Documents/shadowSSR.sh