bingoogolapple.github.io icon indicating copy to clipboard operation
bingoogolapple.github.io copied to clipboard

ShadowSocks

Open bingoogolapple opened this issue 7 years ago • 2 comments

Centos 安装 ShadowSocks

安装 ShadowSocks

  • 更新 yum
sudo yum update
  • 安装 pip
yum install python-setuptools && easy_install pip
  • 安装 ShadowSocks
pip install shadowsocks

启动 ShadowSocks

  • 新建配置文件「vim 」
{
    "server":"0.0.0.0",
    "local_address": "127.0.0.1",
    "local_port":本地端口号,
    "port_password":{
    	"客户端连接时的端口号1":"密码1",
    	"客户端连接时的端口号2":"密码2",
    	"客户端连接时的端口号2":"密码3"
    },
    "timeout":300,
    "method":"rc4-md5",
    "fast_open": true
}
  • 增加别名快捷启动「vim ~/.bashrc」追加如下内容
alias startss='ssserver -c /etc/shadowsocks.json -d start'
alias stopss='ssserver -c /etc/shadowsocks.json -d stop'
  • source ~/.bashrc
  • 启动 startss
  • 停止 stopss
  • 查看日志 sudo less /var/log/shadowsocks.log
  • 开机启动 vim /etc/rc.local
sudo ssserver -c /etc/shadowsocks.json -d start

配置自启动

  • vim /etc/systemd/system/shadowsocks.service
[Unit]
Description=Shadowsocks
[Service]
TimeoutStartSec=0
ExecStart=/usr/bin/sslocal -c /etc/shadowsocks.json
[Install]
WantedBy=multi-user.target
  • 启动 Shadowsocks 服务
systemctl enable shadowsocks.service
systemctl start shadowsocks.service
systemctl status shadowsocks.service

bingoogolapple avatar Aug 12 '17 16:08 bingoogolapple

多账户管理

安装 Node.js

  • 安装 nvm
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.0/install.sh | bash
  • 安装 Node 6
nvm install 6
  • 安装 ShadowSocks-Manager
npm i -g shadowsocks-manager

准备 screen

  • 安装 screen
yum install screen
rpm -qa|grep screen
  • 查看会话列表
screen -list
  • 杀死进程
kill -9 进程号
  • 清除被杀死的会话
screen -wipe

运行 ssmgr

  • 开启 ShadowSocks。如果没有提示 started,则先执行 ssserver -d stop
ssserver -m rc4-md5 -p 端口1 -k 密码1 --manager-address 127.0.0.1:端口2 -d start
  • mkdir ~/.ssmgr
  • vim ~/.ssmgr/ss.yml
type: s

shadowsocks:
  address: 127.0.0.1:端口2
manager:
  address: 0.0.0.0:端口3
  password: '密码2'
db: 'ss.sqlite'
  • vim ~/.ssmgr/webgui.yml
type: m

manager:
  address: IP地址:端口3
  password: '密码2'
plugins:
  flowSaver:
    use: true
  user:
    use: true
  account:
    use: true
  macAccount:
    use: true
  group:
    use: true
  email:
    use: true
    type: 'smtp'
    username: '邮箱'
    password: '邮箱密码'
    host: 'smtp.163.com'
  webgui:
    use: true
    host: '0.0.0.0'
    port: '80'
    site: 'ip地址或域名'

db: 'webgui.sqlite'
  • screen -dmS ssmgr ssmgr -c ~/.ssmgr/ss.yml
  • screen -dmS webgui ssmgr -c ~/.ssmgr/webgui.yml
  • 别名 vim ~/.bashrc
alias startssserver='ssserver -m rc4-md5 -p 端口 -k 密码 --manager-address 127.0.0.1:端口2 -d start'
alias stopssserver='ssserver -d stop'

alias startssmgr='screen -dmS ssmgr ssmgr -c ~/.ssmgr/ss.yml'
alias startssmgrui='screen -dmS webgui ssmgr -c ~/.ssmgr/webgui.yml'

bingoogolapple avatar Jun 29 '18 10:06 bingoogolapple

Centos 翻墙

yum y install epel-release python-pip
pip install --upgrade pip
pip install shadowsocks
  • vim /etc/shadowsocks.json
{
  "server": "x.x.x.x",
  "server_port": 0,
  "local_address": "127.0.0.1",
  "local_port": 1080,
  "password": "pwd",
  "timeout": 300,
  "method": "aes-256-cfb",
  "fast_open": false,
  "workers": 1
}
  • vim /etc/systemd/system/shadowsocks.service
[Unit]
Description=Shadowsocks
[Service]
TimeoutStartSec=0
ExecStart=/usr/bin/sslocal -c /etc/shadowsocks.json
[Install]
WantedBy=multi-user.target
systemctl enable shadowsocks.service
systemctl start shadowsocks.service
systemctl status shadowsocks.service
  • 如果返回你的 ss 服务器 ip 则测试成功
curl --socks5 127.0.0.1:1080 http://httpbin.org/ip
  • 安装 privoxy
yum -y install privoxy
  • 配置 socks5 全局代理
echo 'forward-socks5 / 127.0.0.1:1080 .' >> /etc/privoxy/config
privoxy /etc/privoxy/config
  • 设置 http/https 代理,privoxy 默认监听端口为 8118
alias sson='export http_proxy=http://127.0.0.1:8118 && export https_proxy=http://127.0.0.1:8118 && export no_proxy=localhost && systemctl start privoxy'
alias ssoff='unset http_proxy && unset https_proxy && systemctl stop privoxy'
systemctl enable privoxy
systemctl start privoxy
systemctl status privoxy

bingoogolapple avatar Dec 09 '18 13:12 bingoogolapple