首页 > 技术文章 > vulter-vps

deehuang 2021-01-20 13:37 原文

红杏出墙教程整理:

linux-SSR安装及使用

访问:https://github.com/the0demiurge/CharlesScripts/blob/master/charles/bin/ssr

  1. 复制其中代码,到/usr/local/bin文件下创建文件

    sudo vim /usr/local/bin/ssr
    #然后将赋值的代码粘贴进去,wq!保存退出
    
  2. 给ssr授权

    sudo chmod 777 ssr
    
  3. 启动下载程序

    ssr install
    #自动安装到 $HOME/.local/share/shadowsocksr
    
  4. 配置ssr文件

    ssr config
    

    会出现如下配置信息:

    {
        "server": "0.0.0.0",
        "server_ipv6": "::",
        "server_port": 1111,
        "local_address": "127.0.0.1",
        "local_port": 1080,
    
        "password": "mima",
        "method": "aes-256-cfb",
        "protocol": "auth_sha1_v4_compatible",
        "protocol_param": "",
        "obfs": "plain",
        "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
    }
    
    

    (设置上你的vps服务器上的ssr服务端信息)

  5. 保存退出后,ssr自动读取配置启动程序,出现如下配置信息,完成。

    ~ >>> ssr config                                                                                         
    IPv6 support
    stopped
    IPv6 support
    2021-01-20 22:31:34 INFO     util.py:85 loading libcrypto from libcrypto.so.1.1
    started
    Testing Connection...
    local_port is 1080; if any exceptions orrured, please install jq
    connection information:
    {
      "ip": "x.x.x.1x",
      "hostname": "x.com",
      "city": "Hemet",
      "region": "California",
      "country": "US",
      "loc": "33.7476,-116.9731",
      "org": "AS20473 Choopa, LLC",
      "postal": "92546",
      "timezone": "America/Los_Angeles",
      "readme": "https://ipinfo.io/missingauth"
    }
    IP      : xx.xx.xx.135
    地址    : 美国  加利福尼亚州  洛杉矶
    运营商  : xxx
    
    数据二  : 美国 | 加利福尼亚州洛杉矶Choopa数据中心
    
    数据三  : 美国加利福尼亚
    
    URL     : 
    
    Checking delay...
    [proxychains] config file found: /etc/proxychains.conf
    [proxychains] preloading /usr/lib/libproxychains4.so
    [proxychains] DLL init: proxychains-ng 4.14
    PING cip.cc (224.0.0.1) 56(84) 比特的数据。
    64 比特,来自 192.168.0.196 (192.168.0.196): icmp_seq=1 ttl=64 时间=791 毫秒
    64 比特,来自 192.168.0.196 (192.168.0.196): icmp_seq=2 ttl=64 时间=394 毫秒
    64 比特,来自 192.168.0.196 (192.168.0.196): icmp_seq=3 ttl=64 时间=313 毫秒
    64 比特,来自 192.168.0.196 (192.168.0.196): icmp_seq=4 ttl=64 时间=234 毫秒
    64 比特,来自 192.168.0.196 (192.168.0.196): icmp_seq=5 ttl=64 时间=464 毫秒
    
    --- cip.cc ping 统计 ---
    已发送 5 个包, 已接收 5 个包, 0% packet loss, time 4004ms
    
    
  6. 因为ss默认使用的是socket5协议,我们浏览器访问网站通常是http协议,所以需要下载polipo转换协议

    yay -Sy polipo #安装
    sudo systemctl start polipo.service  #启动
    sudo systemctl enable polipo.service #开机自启动
    
    #配置polipo配置文件
    /etc >>> cd polipo                                                                /etc/polipo >>> ls                                                               config.sample  forbidden.sample  #进入配置文件夹会发现有配置文件demo在,复制一份  
    
    /etc/polipo >>> sudo cp config.sample config  
    /etc/polipo >>> sudo vim config  
    #找到这部分
    # Uncomment this if you want to use a parent SOCKS proxy:
    
    # socksParentProxy = "localhost:9050"
    # socksProxyType = socks5
    
    # Uncomment this if you want to scrub private information from the log:
    
    #将 socksParentProxy和socksProxyType取消注释,socksParentProxy端口改成ss的端口,如1080,搞定
    
    #polipo默认代理的端口是8123,可以自己配置这个端口
    #找到proxyAddress解除注释,并在下面加上
    proxyPort = 1081
    
    #保存退出编辑,修改http代理
    export http_proxy="localhost:1081" 
    #重启polipo
    sudo systemctl restart polipo
    
    #出现下面的话表示成功
     ~ >>> systemctl start polipo.service                                                                                                                                                                                                       
     ~ >>> systemctl status polipo.service                                                                                                                                                                                                      
    ● polipo.service - Polipo Proxy Server
      Loaded: loaded (/usr/lib/systemd/system/polipo.service; disabled; vendor preset: disabled)
      Active: active (running) since Wed 2021-01-20 23:10:12 CST; 7s ago
    Main PID: 98439 (polipo)
       Tasks: 1 (limit: 9378)
      Memory: 260.0K
      CGroup: /system.slice/polipo.service
              └─98439 /usr/bin/polipo
    
    1月 20 23:10:12 jochen-inspiron7559 systemd[1]: Started Polipo Proxy Server.
    1月 20 23:10:12 jochen-inspiron7559 polipo[98439]: Established listening socket on port 1081.
    
    
  7. 配置终端代理,将polipo将socket5转为了http,我们可以在终端使用

    ~ >>> export http_proxy=http://127.0.0.1:1081                                                                                                                                                                 
    ~ >>> export https_proxy=https://127.0.0.1:1081                                                                                                                                                                                            
    ~ >>> curl www.google.com                                                                                                                                                                                                                  
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html><head>
    <title>Proxy error: 502 Server dropped connection.</title>
    </head><body>
    <h1>502 Server dropped connection</h1>
    <p>The following error occurred while trying to access <strong>http://www.google.com/</strong>:<br><br>
    <strong>502 Server dropped connection</strong></p>
    <hr>Generated Wed, 20 Jan 2021 23:15:57 CST by Polipo on <em>jochen-inspiron7559:1081</em>.
    </body></html>
    
    
  8. 下载谷歌插件:switchyomega,配置SSR,此处看=》SS/SSR搭建教程有提到

推荐链接:https://www.quchao.net/ShadowsocksR.html

推荐阅读