2017年3月

VPS环境Ubuntu 14.04 LTS x86_64
Note:VPS环境自带Apache2

  1. 系统更新

     apt-get update && apt-get upgrade
  2. 安装php

     apt-get install php5 libapache2-mod-php5 php5-mcrypt php5-sqlite php5-curl
  3. 安装Typecho
  4. 安装并配置shadowsocks

     apt-get install python-pip
     pip install shadowsocks

    服务器配置

    vim /etc/shadowsocks.json

    自动启动

     vim /etc/rc.local

    exit 0前加入

     ssserver -c /etc/shadowsocks.json -d start
  5. 安装aria2、youtube-dl、bypy

     apt-get install aria2
     pip install youtube-dl bypy
  6. 主要文件、数据库备份

accelerate shadowsocks by kcptun
from:
http://www.cmsky.com/kcptun/
https://github.com/skywind3000/kcp

1.server side: download and deflate kcptun
2.server side: add start/stop/restart/autostart script and make them excutable
start.sh

    ./server_linux_amd64 -l :29900 -t {server ip}:8388 -key {your key} -mtu 1400 -sndwnd 2048 -rcvwnd 2048 -mode fast2 > kcptun.log 2>&1 &

stop.sh

    #!/bin/bash
    PID=`ps -ef | grep server_linux_amd64 | grep -v grep | awk '{print $2}'`
    if [[ "" != "$PID" ]]; then
    echo "killing $PID"
    kill -9 $PID
    fi

restart.sh

    #!/bin/bash
    cd /root/kcptun/
    echo "Stopping Kcptun..."
    sh stop.sh
    sh start.sh
    echo "Kcptun started."

add to autostart: put following command into /etc/rc.local behind shadowsocks auto start command

    sh /root/kcptun/start.sh

3.server side: start kcptun server by exec start.sh
4.client side: download and deflate kcptun
5.client side: add start/stop/autostart scipts
run.vbs

    Dim RunKcptun
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set WshShell = WScript.CreateObject("WScript.Shell")
    '获取文件路径
    currentPath = fso.GetFile(Wscript.ScriptFullName).ParentFolder.Path & "\"
    '软件运行参数
    exeConfig = "client_windows_amd64.exe -l :12948 -r {server ip}:29900 -key {your key} -mtu 1400 -sndwnd 256 -rcvwnd 2048 -mode fast2 -dscp 46"
    '日志文件
    logFile = "kcptun.log"
    '拼接命令行
    cmdLine = "cmd /c " & currentPath & exeConfig & " > " & currentPath & logFile & " 2>&1"
    '启动软件
    WshShell.Run cmdLine, 0, False
    '等待1秒
    'WScript.Sleep 1000
    '打印运行命令
    'Wscript.echo cmdLine
    Set WshShell = Nothing
    Set fso = Nothing
    '退出脚本
    WScript.quit

stop.bat

    taskkill /f /im client_windows_amd64.exe

startup.bat

    @echo off
    title Kcptun 开机启动设置
    mode con cols=50 lines=20
    color A
    echo.
    echo. Kcptun 启动项设置
    echo.
    echo. 此批处理可以将 Kcptun 客户端添加到开机启动
    echo.
    echo. 请将该文件放到 run.vbs 相同目录后运行
    echo.
    echo. 查看说明:https://blog.kuoruan.com/102.html
    echo.
    set /p ST=输入 y 添加开机启动,输入 n 取消开机启动:
    if /I "%ST%"=="y" goto addStartup
    if /I "%ST%"=="n" goto delStartup
    :addStartup
    reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v "Kcptun Client" /t REG_SZ /d "\"%~dp0run.vbs\"" /F>NUL
    exit
    :delStartup
    reg delete "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v "kcptun Client" /F>NUL 2>NUL
    exit

6.client side: start kcptun client by double click run.vbs and check task manager for process named "client_windows_amd64.exe"
7.client side: shadowsocks client config and start

server:127.0.0.1:12948
key:shadowsocks key!
encryption method: shadowsocks encryption method