Skip to content

Instantly share code, notes, and snippets.

@rampageX
Created February 9, 2019 11:30
Show Gist options
  • Star 15 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rampageX/134fa08a547d4b1eabd754c279b12676 to your computer and use it in GitHub Desktop.
Save rampageX/134fa08a547d4b1eabd754c279b12676 to your computer and use it in GitHub Desktop.
Install Shadowsocks With V2Ray Manually

Installing Packages

sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get dist-upgrade -y && sudo apt-get autoremove -y && sudo apt-get clean && sudo apt-get install build-essential haveged -y
sudo apt-get install linux-headers-$(uname -r)
sudo apt-get install curl -y
sudo apt-get install shadowsocks-libev -y
sudo apt-get install cron -y
sudo apt-get install screen -y

Install V2Ray

cd /etc/shadowsocks-libev/
https://github.com/shadowsocks/v2ray-plugin/releases
dpkg --print-architecture
wget
tar -xvzf
rm

Changing Limits

echo '* soft nofile 51200' >> /etc/security/limits.conf
echo '* hard nofile 51200' >> /etc/security/limits.conf
ulimit -n 51200

Removing Systemctl

rm /etc/sysctl.conf

Optimizing SS

echo 'fs.file-max = 51200
net.core.rmem_max = 67108864
net.core.wmem_max = 67108864
net.core.netdev_max_backlog = 250000
net.core.somaxconn = 4096
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_time = 1200
net.ipv4.ip_local_port_range = 10000 65000
net.ipv4.tcp_max_syn_backlog = 8192
net.ipv4.tcp_max_tw_buckets = 5000
net.ipv4.tcp_fastopen = 3
net.ipv4.tcp_mem = 25600 51200 102400
net.ipv4.tcp_rmem = 4096 87380 67108864
net.ipv4.tcp_wmem = 4096 65536 67108864
net.ipv4.tcp_mtu_probing = 1
net.ipv4.tcp_congestion_control = hybla' >> /etc/sysctl.conf
sysctl -p

Google BBR

curl -sSL https://gist.githubusercontent.com/LiveChief/5ba1221548cb79480ea06cf9595f8f17/raw/5e5d19c66c3778b1e26ce0efb09133759cba3a7b/bbr.sh | bash
uname -r
sysctl net.ipv4.tcp_available_congestion_control
sysctl net.ipv4.tcp_congestion_control
sysctl net.core.default_qdisc
lsmod | grep bbr
sysctl -p

Server

nano /etc/shadowsocks-libev/config.json
{
    "server":"0.0.0.0",
    "server_port":80,
    "password":"PASSWORD",
    "timeout":300,
    "user":"nobody",
    "method":"aes-256-gcm",
    "nameserver": "8.8.8.8",
    "fast_open":true,
    "reuse_port":true,
    "no_delay":true,
    "plugin":"/etc/shadowsocks-libev/",
    "plugin_opts":"server"
}

Client

nano /etc/shadowsocks-libev/config.json
{
    "server":"0.0.0.0",
    "server_port":80,
    "local_port":1080,
    "password":"PASSWORD",
    "method":"aes-256-gcm",
    "plugin":"/etc/shadowsocks-libev/",
    "plugin_opts":"host=example.com"
}

Startup Script

nano /etc/shadowsocks-libev/ss-startup.sh
#!/bin/sh
if [ -z "$STY" ]; then exec screen -dm -S screenName /bin/bash "$0"; fi
ss-[local|server]
exit 0

Executable

chmod a+x /etc/shadowsocks-libev/ss-startup.sh

Crontab

crontab -e
@reboot /etc/shadowsocks-libev/ss-startup.sh
@Kein
Copy link

Kein commented Oct 8, 2021

What's Google BBR for? Looks like it requires kernel 4.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment