CentOs7安装Shadowsocks

CentOs7安装Shadowsocks

登录服务器设置ssh登录

  1. ssh root@youIp
  2. ssh-keygen 或者 ssh-keygen -t rsa -C "[email protected]"
  3. ssh-copy-id -i /root/.ssh/id_rsa.pub root@youIp

shadowsocks的搭建

  • wget获取原包

    wget --no-check-certificate -O shadowsocks-all.sh https://raw.githubusercontent.com/teddysun/shadowsocks_install/master/shadowsocks-all.sh
    
  • 给权限

    chmod +x shadowsocks-all.sh
    
  • 安装和日志

    ./shadowsocks-all.sh 2>&1 | tee shadowsocks-all.log
    
  • 选择其中一个版本 Shadowsocks-Python, ShadowsocksR, Shadowsocks-Go, Shadowsocks-libev 版

  • 输入你要设置的密码

开启 TCP Fast Open

  • 修改 nano /etc/rc.local 在最后一行增加,ctrl+xy 保存退出

    echo 3 > /proc/sys/net/ipv4/tcp_fastopen
    
  • 修改 nano /etc/sysctl.conf,同理增加

    net.ipv4.tcp_fastopen = 3
    
  • 在对应的配置文件增加

    "fast_open":true
    

Shadowsocks-Python 版(小编选装的是此版本):/etc/shadowsocks-python/config.json
ShadowsocksR 版:/etc/shadowsocks-r/config.json
Shadowsocks-Go 版:/etc/shadowsocks-go/config.json
Shadowsocks-libev 版:/etc/shadowsocks-libev/config.json

配置文件还有重启服务

单用户配置文件事例:

{
    "server":"0.0.0.0",
    "server_port":8989,
    "local_address":"127.0.0.1",
    "local_port":1080,
    "password":"yourpassword",
    "timeout":300,
    "method":"aes-256-cfb",
    "fast_open": false
}

多用户多端口配置事例:

{
    "server":"0.0.0.0",
    "local_address":"127.0.0.1",
    "local_port":1080,
    "port_password":{
         "8989":"password0",
         "9001":"password1",
         "9002":"password2",
         "9003":"password3",
         "9004":"password4"
    },
    "timeout":300,
    "method":"aes-256-cfb",
    "fast_open": false
}
  • 每个版本的重启

    Shadowsocks-Python 版:
    /etc/init.d/shadowsocks-python start | stop | restart | status
    ShadowsocksR 版:
    /etc/init.d/shadowsocks-r start | stop | restart | status
    Shadowsocks-Go 版:
    /etc/init.d/shadowsocks-go start | stop | restart | status
    Shadowsocks-libev 版:
    /etc/init.d/shadowsocks-libev start | stop | restart | status
    
  • 卸载方法

    若已安装多个版本,则卸载时也需多次运行(每次卸载一种)

    使用root用户登录,运行以下命令:

    ./shadowsocks-all.sh uninstall
    

原文地址: http://biyongyao.com/archives/214

猜你喜欢

转载自blog.csdn.net/biyongyao/article/details/78155665