Skip to content

Instantly share code, notes, and snippets.

@xuyuji9000
Forked from zhiguangwang/README.md
Created December 21, 2024 22:46
Show Gist options
  • Save xuyuji9000/fdb7166ccd2c296ccddcc524e64775d1 to your computer and use it in GitHub Desktop.
Save xuyuji9000/fdb7166ccd2c296ccddcc524e64775d1 to your computer and use it in GitHub Desktop.

Revisions

  1. @zhiguangwang zhiguangwang revised this gist Jun 13, 2019. 1 changed file with 9 additions and 1 deletion.
    10 changes: 9 additions & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -55,7 +55,11 @@

    ## Use TCP BBR

    This will install linux kernel 4.9 and enable TCP BBR congestion control algorithm to improve network bandwidth utilization (10x improvement is not uncommon).
    This will enable TCP BBR congestion control algorithm to improve network bandwidth utilization (10x improvement is not uncommon).

    ### Install linux kernel 4.9

    Note: do this only if the distribution comes with a older kernel version.

    ```
    URL=http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.9.9/linux-image-4.9.9-040909-generic_4.9.9-040909.201702090333_amd64.deb
    @@ -64,7 +68,11 @@ wget $URL
    sudo dpkg -i $(basename $URL)
    sudo reboot
    ```

    ### Enable TCP BBR

    ```
    SYSCTL_CONF=/etc/sysctl.d/60-tcp-bbr.conf
    echo "net.core.default_qdisc=fq" | sudo tee $SYSCTL_CONF
    echo "net.ipv4.tcp_congestion_control=bbr" | sudo tee -a $SYSCTL_CONF
  2. @zhiguangwang zhiguangwang revised this gist Jun 8, 2019. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions ss.json
    Original file line number Diff line number Diff line change
    @@ -3,6 +3,8 @@
    "server_port": "[port]",
    "password": "[password]",
    "timeout": 300,
    "method": "aes-256-cfb",
    "fast_open": true
    "method": "xchacha20-ietf-poly1305",
    "mode": "tcp_only",
    "fast_open": true,
    "nameserver": "8.8.8.8"
    }
  3. @zhiguangwang zhiguangwang revised this gist Jan 5, 2018. 1 changed file with 4 additions and 3 deletions.
    7 changes: 4 additions & 3 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -65,9 +65,10 @@ sudo dpkg -i $(basename $URL)
    sudo reboot
    echo "net.core.default_qdisc=fq" | sudo tee -a /etc/sysctl.conf
    echo "net.ipv4.tcp_congestion_control=bbr" | sudo tee -a /etc/sysctl.conf
    sudo sysctl -p
    SYSCTL_CONF=/etc/sysctl.d/60-tcp-bbr.conf
    echo "net.core.default_qdisc=fq" | sudo tee $SYSCTL_CONF
    echo "net.ipv4.tcp_congestion_control=bbr" | sudo tee -a $SYSCTL_CONF
    sudo sysctl -p $SYSCTL_CONF
    sysctl net.ipv4.tcp_available_congestion_control
    sysctl net.ipv4.tcp_congestion_control
  4. @zhiguangwang zhiguangwang revised this gist Feb 26, 2017. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -14,6 +14,7 @@
    1. Restart the `shadowsocks-libev` service.

    sudo systemctl restart shadowsocks-libev
    sudo systemctl status shadowsocks-libev

    ## 16.04 xenial

  5. @zhiguangwang zhiguangwang revised this gist Feb 26, 2017. 1 changed file with 24 additions and 38 deletions.
    62 changes: 24 additions & 38 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -2,69 +2,55 @@

    ## 16.10 yakkety and above

    Use the `shadowsocks-libev` package.

    1. Install the the `shadowsocks-libev` package from apt repository.

    ```
    sudo apt update
    sudo apt install shadowsocks-libev
    ```
    sudo apt update
    sudo apt install shadowsocks-libev

    1. Put `ss.json` as `/etc/shadowsocks-libev/config.json`.
    1. Save `ss.json` as `/etc/shadowsocks-libev/config.json`.

    1. Replace **server_port** and **password** in `ss.json` with your own choices.

    1. Restart the `shadowsocks-libev` service:
    1. Restart the `shadowsocks-libev` service.

    ```
    sudo systemctl restart shadowsocks-libev
    ```
    sudo systemctl restart shadowsocks-libev

    ## 16.04 xenial (with Systemd)
    ## 16.04 xenial

    1. Install shadowsocks with pip:
    1. Install shadowsocks with pip.

    ```
    sudo apt update
    sudo apt install python-pip
    sudo pip install shadowsocks
    ```
    sudo apt update
    sudo apt install python-pip
    sudo pip install shadowsocks

    1. Put `ss.json` under `/etc/shadowsocks/`.
    1. Save `ss.json` under `/etc/shadowsocks/`.

    1. Replace **server_port** and **password** in `ss.json` with your own choices.

    1. Put `ssserver.service` under `/usr/lib/systemd/system/`
    1. Save `ssserver.service` under `/usr/lib/systemd/system/`

    1. Run the following commands:
    1. Enable the systemd service.

    ```
    sudo systemctl enable ssserver
    sudo systemctl start ssserver
    sudo systemctl status ssserver
    ```
    sudo systemctl enable ssserver
    sudo systemctl start ssserver
    sudo systemctl status ssserver

    ## 14.04 trusty (without Systemd)
    ## 14.04 trusty

    1. Install shadowsocks with pip:
    1. Install shadowsocks with pip.

    ```
    sudo apt-get update
    sudo apt-get install python-pip
    sudo pip install shadowsocks
    ```
    sudo apt-get update
    sudo apt-get install python-pip
    sudo pip install shadowsocks

    1. Put `ss.json`, `start.sh`, `stop.sh` under `/etc/shadowsocks/`.
    1. Save `ss.json`, `start.sh`, `stop.sh` under `/etc/shadowsocks/`.

    1. Replace **server_port** and **password** in `ss.json` with your own choices.

    1. Put the following in `/etc/rc.local` to start **ssserver** upon server start.

    ```shell
    # Start shadowsocks server
    /etc/shadowsocks/start.sh
    ```
    # Start shadowsocks server
    /etc/shadowsocks/start.sh

    ## Use TCP BBR

  6. @zhiguangwang zhiguangwang revised this gist Feb 26, 2017. 2 changed files with 37 additions and 9 deletions.
    41 changes: 37 additions & 4 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,35 @@
    # Installing and running shadowsocks on Ubuntu Server

    ## On Ubuntu Server 16.04 (with Systemd)
    ## 16.10 yakkety and above

    1. Run `install.sh` to install Shadowsocks.
    Use the `shadowsocks-libev` package.

    1. Install the the `shadowsocks-libev` package from apt repository.

    ```
    sudo apt update
    sudo apt install shadowsocks-libev
    ```

    1. Put `ss.json` as `/etc/shadowsocks-libev/config.json`.

    1. Replace **server_port** and **password** in `ss.json` with your own choices.

    1. Restart the `shadowsocks-libev` service:

    ```
    sudo systemctl restart shadowsocks-libev
    ```

    ## 16.04 xenial (with Systemd)

    1. Install shadowsocks with pip:

    ```
    sudo apt update
    sudo apt install python-pip
    sudo pip install shadowsocks
    ```

    1. Put `ss.json` under `/etc/shadowsocks/`.

    @@ -18,9 +45,15 @@ sudo systemctl start ssserver
    sudo systemctl status ssserver
    ```

    ## On Ubuntu Server 14.04 (without Systemd)
    ## 14.04 trusty (without Systemd)

    1. Install shadowsocks with pip:

    1. Run `install.sh` to install Shadowsocks.
    ```
    sudo apt-get update
    sudo apt-get install python-pip
    sudo pip install shadowsocks
    ```

    1. Put `ss.json`, `start.sh`, `stop.sh` under `/etc/shadowsocks/`.

    5 changes: 0 additions & 5 deletions install.sh
    Original file line number Diff line number Diff line change
    @@ -1,5 +0,0 @@
    #!/bin/bash

    sudo apt-get update
    sudo apt-get install python-pip
    sudo pip install shadowsocks
  7. @zhiguangwang zhiguangwang revised this gist Feb 11, 2017. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -48,6 +48,7 @@ sudo reboot
    echo "net.core.default_qdisc=fq" | sudo tee -a /etc/sysctl.conf
    echo "net.ipv4.tcp_congestion_control=bbr" | sudo tee -a /etc/sysctl.conf
    sudo sysctl -p
    sysctl net.ipv4.tcp_available_congestion_control
    sysctl net.ipv4.tcp_congestion_control
    lsmod | grep bbr
  8. @zhiguangwang zhiguangwang revised this gist Feb 11, 2017. 1 changed file with 20 additions and 0 deletions.
    20 changes: 20 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -31,4 +31,24 @@ sudo systemctl status ssserver
    ```shell
    # Start shadowsocks server
    /etc/shadowsocks/start.sh
    ```

    ## Use TCP BBR

    This will install linux kernel 4.9 and enable TCP BBR congestion control algorithm to improve network bandwidth utilization (10x improvement is not uncommon).

    ```
    URL=http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.9.9/linux-image-4.9.9-040909-generic_4.9.9-040909.201702090333_amd64.deb
    wget $URL
    sudo dpkg -i $(basename $URL)
    sudo reboot
    echo "net.core.default_qdisc=fq" | sudo tee -a /etc/sysctl.conf
    echo "net.ipv4.tcp_congestion_control=bbr" | sudo tee -a /etc/sysctl.conf
    sudo sysctl -p
    sysctl net.ipv4.tcp_available_congestion_control
    sysctl net.ipv4.tcp_congestion_control
    lsmod | grep bbr
    ```
  9. @zhiguangwang zhiguangwang revised this gist Feb 8, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -12,7 +12,7 @@

    1. Run the following commands:

    ```shell
    ```
    sudo systemctl enable ssserver
    sudo systemctl start ssserver
    sudo systemctl status ssserver
  10. @zhiguangwang zhiguangwang revised this gist Feb 7, 2017. 2 changed files with 32 additions and 0 deletions.
    20 changes: 20 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,25 @@
    # Installing and running shadowsocks on Ubuntu Server

    ## On Ubuntu Server 16.04 (with Systemd)

    1. Run `install.sh` to install Shadowsocks.

    1. Put `ss.json` under `/etc/shadowsocks/`.

    1. Replace **server_port** and **password** in `ss.json` with your own choices.

    1. Put `ssserver.service` under `/usr/lib/systemd/system/`

    1. Run the following commands:

    ```shell
    sudo systemctl enable ssserver
    sudo systemctl start ssserver
    sudo systemctl status ssserver
    ```

    ## On Ubuntu Server 14.04 (without Systemd)

    1. Run `install.sh` to install Shadowsocks.

    1. Put `ss.json`, `start.sh`, `stop.sh` under `/etc/shadowsocks/`.
    12 changes: 12 additions & 0 deletions ssserver.service
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    [Unit]
    Description=Daemon to start shadowsocks server
    Wants=network-online.target
    After=network.target

    [Service]
    Type=simple
    ExecStart=/usr/local/bin/ssserver -c /etc/shadowsocks/ss.json -qq
    User=nobody

    [Install]
    WantedBy=multi-user.target
  11. @zhiguangwang zhiguangwang revised this gist Feb 7, 2017. 3 changed files with 4 additions and 4 deletions.
    4 changes: 2 additions & 2 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -2,13 +2,13 @@

    1. Run `install.sh` to install Shadowsocks.

    1. Put `ss.json`, `start.sh`, `stop.sh` under `/var/shadowsocks/`.
    1. Put `ss.json`, `start.sh`, `stop.sh` under `/etc/shadowsocks/`.

    1. Replace **server_port** and **password** in `ss.json` with your own choices.

    1. Put the following in `/etc/rc.local` to start **ssserver** upon server start.

    ```shell
    # Start shadowsocks server
    /var/shadowsocks/start.sh
    /etc/shadowsocks/start.sh
    ```
    2 changes: 1 addition & 1 deletion start.sh
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,3 @@
    #!/bin/bash

    sudo /usr/local/bin/ssserver -c /var/shadowsocks/ss.json --user nobody -qq -d start
    sudo /usr/local/bin/ssserver -c /etc/shadowsocks/ss.json --user nobody -qq -d start
    2 changes: 1 addition & 1 deletion stop.sh
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,3 @@
    #!/bin/bash

    sudo /usr/local/bin/ssserver -c /var/shadowsocks/ss.json -d stop
    sudo /usr/local/bin/ssserver -c /etc/shadowsocks/ss.json -d stop
  12. @zhiguangwang zhiguangwang renamed this gist Feb 7, 2017. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  13. @zhiguangwang zhiguangwang renamed this gist Feb 7, 2017. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  14. @zhiguangwang zhiguangwang revised this gist Apr 22, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ss.json
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    {
    "server": "0.0.0.0",
    "server_port": [port],
    "server_port": "[port]",
    "password": "[password]",
    "timeout": 300,
    "method": "aes-256-cfb",
  15. @zhiguangwang zhiguangwang revised this gist Apr 8, 2016. 6 changed files with 33 additions and 45 deletions.
    14 changes: 14 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    # Installing and running shadowsocks on Ubuntu Server

    1. Run `install.sh` to install Shadowsocks.

    1. Put `ss.json`, `start.sh`, `stop.sh` under `/var/shadowsocks/`.

    1. Replace **server_port** and **password** in `ss.json` with your own choices.

    1. Put the following in `/etc/rc.local` to start **ssserver** upon server start.

    ```shell
    # Start shadowsocks server
    /var/shadowsocks/start.sh
    ```
    5 changes: 5 additions & 0 deletions install.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    #!/bin/bash

    sudo apt-get update
    sudo apt-get install python-pip
    sudo pip install shadowsocks
    45 changes: 0 additions & 45 deletions shadowsocks.md
    Original file line number Diff line number Diff line change
    @@ -1,45 +0,0 @@
    Install (Ubuntu Server)

    ```shell
    sudo apt-get update
    sudo apt-get install python-pip
    sudo pip install shadowsocks
    ```

    Configuration

    ss.json

    ```json
    {
    "server": "0.0.0.0",
    "server_port": [port],
    "password": "[password]",
    "timeout": 300,
    "method": "aes-256-cfb",
    "fast_open": true
    }
    ```

    start.sh

    ```shell
    #!/bin/bash

    sudo /usr/local/bin/ssserver -c /var/shadowsocks/ss.json --user nobody -qq -d start
    ```

    stop.sh

    ```shell
    #!/bin/bash

    sudo /usr/local/bin/ssserver -d stop
    ```

    Invoke `start.sh` in `/etc/rc.local`

    ```shell
    # Start shadowsocks server
    /var/shadowsocks/start.sh
    ```
    8 changes: 8 additions & 0 deletions ss.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    {
    "server": "0.0.0.0",
    "server_port": [port],
    "password": "[password]",
    "timeout": 300,
    "method": "aes-256-cfb",
    "fast_open": true
    }
    3 changes: 3 additions & 0 deletions start.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    #!/bin/bash

    sudo /usr/local/bin/ssserver -c /var/shadowsocks/ss.json --user nobody -qq -d start
    3 changes: 3 additions & 0 deletions stop.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    #!/bin/bash

    sudo /usr/local/bin/ssserver -c /var/shadowsocks/ss.json -d stop
  16. @zhiguangwang zhiguangwang revised this gist Mar 15, 2016. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions shadowsocks.md
    Original file line number Diff line number Diff line change
    @@ -33,6 +33,7 @@ stop.sh

    ```shell
    #!/bin/bash

    sudo /usr/local/bin/ssserver -d stop
    ```

  17. @zhiguangwang zhiguangwang revised this gist Mar 15, 2016. 1 changed file with 12 additions and 2 deletions.
    14 changes: 12 additions & 2 deletions shadowsocks.md
    Original file line number Diff line number Diff line change
    @@ -21,14 +21,24 @@ ss.json
    }
    ```

    Start
    start.sh

    ```shell
    #!/bin/bash

    sudo /usr/local/bin/ssserver -c /var/shadowsocks/ss.json --user nobody -qq -d start
    ```

    Stop
    stop.sh

    ```shell
    #!/bin/bash
    sudo /usr/local/bin/ssserver -d stop
    ```

    Invoke `start.sh` in `/etc/rc.local`

    ```shell
    # Start shadowsocks server
    /var/shadowsocks/start.sh
    ```
  18. @zhiguangwang zhiguangwang revised this gist Feb 16, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion shadowsocks.md
    Original file line number Diff line number Diff line change
    @@ -24,7 +24,7 @@ ss.json
    Start

    ```shell
    sudo /usr/local/bin/ssserver -c /var/shadowsocks/ss.json --user nobody -d start
    sudo /usr/local/bin/ssserver -c /var/shadowsocks/ss.json --user nobody -qq -d start
    ```

    Stop
  19. @zhiguangwang zhiguangwang revised this gist Feb 16, 2016. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions shadowsocks.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,7 @@
    Install (Ubuntu Server)

    ```shell
    sudo apt-get update
    sudo apt-get install python-pip
    sudo pip install shadowsocks
    ```
  20. @zhiguangwang zhiguangwang revised this gist Feb 2, 2016. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions shadowsocks.md
    Original file line number Diff line number Diff line change
    @@ -23,11 +23,11 @@ ss.json
    Start

    ```shell
    sudo ssserver -c /var/shadowsocks/ss.json --user nobody -d start
    sudo /usr/local/bin/ssserver -c /var/shadowsocks/ss.json --user nobody -d start
    ```

    Stop

    ```shell
    sudo ssserver -d stop
    sudo /usr/local/bin/ssserver -d stop
    ```
  21. @zhiguangwang zhiguangwang created this gist Feb 2, 2016.
    33 changes: 33 additions & 0 deletions shadowsocks.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,33 @@
    Install (Ubuntu Server)

    ```shell
    sudo apt-get install python-pip
    sudo pip install shadowsocks
    ```

    Configuration

    ss.json

    ```json
    {
    "server": "0.0.0.0",
    "server_port": [port],
    "password": "[password]",
    "timeout": 300,
    "method": "aes-256-cfb",
    "fast_open": true
    }
    ```

    Start

    ```shell
    sudo ssserver -c /var/shadowsocks/ss.json --user nobody -d start
    ```

    Stop

    ```shell
    sudo ssserver -d stop
    ```