How To Install Shadowsocks On Ubuntu To Bypass China GFW

Mighil
Mighil
Oct 28, 2017 · 4 min read

Prerequisites

How To Create A New Droplet In DigitalOcean

How To Install Shadowsocks on Ubuntu 16.04

$ apt-get update
$ apt-get install python-pip
$ pip install shadowsocks
$ apt-get install python-m2crypto
$ apt-get install build-essential
$ wget https://github.com/jedisct1/libsodium/releases/download/1.0.10/libsodium-1.0.10.tar.gz
$ tar xf libsodium-1.0.10.tar.gz && cd libsodium-1.0.10
$ ./configure && make && make install
$ ldconfig
{ 
"server":"your_droplet's_IP_address",
"server_port":8000,
"local_port":1080,
"password":"your_password",
"timeout":600,
"method":"aes-256-cfb"
}
$ ssserver -c /etc/shadowsocks.json -d start
/usr/bin/python /usr/local/bin/ssserver -c /etc/shadowsocks.json -d start

Server Optimization

To increase the maximum number of file descriptors:

* soft nofile 51200
* hard nofile 51200
$ ssserver -c /etc/shadowsocks.json -d stop
$ ulimit -n 51200

To optimize the kernels:

fs.file-max = 51200net.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_tw_recycle = 0
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 = cubic
$ sysctl -p
$ ssserver -c /etc/shadowsocks.json -d start

Shadowsocks Clients:

Mighil

Written by

Mighil

your friendly neighborhood tech-man. mighil.com

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade