You could use any service. Here I’m using Vultr’s Los Angeles server since that’s what works for me. Another really good hosting provider is Linode, but just for the purpose of what we’re doing today, Vultr saves us the trouble of upgrading the kernal.

Your operating system could be any Linux flavor. I’m going with Ubuntu 16.04 LTS x64.

Setting up your own Shadowsocks server

TeddySun wrote a very nice script for setting up the four major flavors of Shadowsocks, and we are just going to use that:

wget --no-check-certificate -O shadowsocks-all.sh https://raw.githubusercontent.com/teddysun/shadowsocks_install/master/shadowsocks-all.sh
chmod +x shadowsocks-all.sh
./shadowsocks-all.sh 2>&1 | tee shadowsocks-all.log

It’s going to ask you which of the four Shadowsocks server (Python, R, Go, libev) you’d like to set up:

Which Shadowsocks server you'd select:
Please enter a number (default 1):

Next, you have to enter the password, and then the port you would like:

You choose = Shadowsocks-Go

Please enter password for Shadowsocks-Go
(default password: teddysun.com):

password = teddysun.com

Please enter a port for Shadowsocks-Go [1-65535]
(default port: 8989):

port = 8989

Press any key to start...or Press Ctrl+C to cancel

Here, for demo purpose, I pressed Enter and used the default settings. It doesn’t really matter what you put here as you can always come back and change the settings in /etc/shadowsocks-go/config.json later on.

Anyways, once that’s done, you’ll get a summary of your configuration, like this:

Congratulations, Shadowsocks-Go server install completed!
Your Server IP        :  45.32.**.**
Your Server Port      :  8989
Your Password         :  teddysun.com
Your Encryption Method:  aes-256-cfb

Advanced Set-ups

Multiple Users

Edit the config.jsonfile, following this template:

    "port_password": {
      "<port-1>": "<port-1-password>",
      "<port-2>": "<port-2-password>"


What’s BBR, you might ask. Well, it’s

Bottleneck Bandwidth and Round-trip Time

To put it simply, it’s something extremely good for juicing the best speed out of your server that Google has made open-source. Sweet right?

Hey Linode users! Now it’s a good time to go and upgrade your kernal before moving on with the rest of the tutorial. Check out the last section of this post if you are not sure how to do that.

Ok, with the right kernal, you should now login using root user, and run the following commands:

wget --no-check-certificate https://github.com/teddysun/across/raw/master/bbr.sh
chmod +x bbr.sh

After that, you will be prompted to reboot your server. Do that with y+Enter.

Then, check if BBR is working normal:

sysctl net.ipv4.tcp_available_congestion_control

should return

net.ipv4.tcp_available_congestion_control = bbr cubic reno

sysctl net.ipv4.tcp_congestion_control

should return

net.ipv4.tcp_congestion_control = bbr

sysctl net.core.default_qdisc

should return

net.core.default_qdisc = fq

lsmod | grep bbr

should return something containing tcp_bbr in return. If not, run the following:

echo "net.core.default_qdisc = fq" >> /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control = bbr" >> /etc/sysctl.conf

Automatic restarts

This step is entirely optional, and unlike TCP BBR, it won’t dramatically increase your connection speed. Nevertheless, what I’m trying to do in this step is to set up a cron job that restarts the server every day at midnight to prevent it from getting sluggish.

First, create a bash script. I put it under /root/restart-ss.sh.

/etc/init.d/shadowsocks-go restart

In the demo above, I was using Shadowsocks-Go. If you’ve gone with one of the other options, you would get an error with line 2, and you might have to just look around to find the right command for restarting your version of the shadowsocks server. For example, for Shadowsocks Python the command should be /etc/init.d/shadowsocks-python restart.

After that, just enter:

crontab -e

and add the following to the last line:

0 0 * * * bash /root/restart-ss.sh >> /root/cron.log

Perfect! Now run this to make sure our cron job is correctly set up and we’re good to go!

service cron restart

Upgrading your Linux Kernal (For Linode Users Only)

First, check your kernal information with:

uname -r

If it returns anything 4.9 and above, you are good to go. But for this instance 4.11+ actually works slightly better with BBR, so I’m still going to show you how kernal upgrade is done with Linode.

Install the Latest Kernal

Go to http://kernel.ubuntu.com/~kernel-ppa/mainline/ to locate the latest linux image. Hint: look for the one that has linux-image and generic in it.

1) Download the latest kernal:

wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.11.5/linux-image-4.11.5-041105-generic_4.11.5-041105.201706141137_amd64.deb

2) Install kernal:

dpkg -i linux-image-4.11.5*.deb

3) Checking if installation is complete:

ls /boot/vmlinuz*

Incidentally, I didn’t purge the old kernal for safety concerns…

Configure GRUB

If you don’t have GRUB installed yet:

apt-get install linux-image-virtual grub2

1) Edit /etc/default/grub and change the parameters to the following:

GRUB_CMDLINE_LINUX =“console = ttyS0,19200n8”
GRUB_SERIAL_COMMAND =“serial --speed = 19200 --unit = 0 --word = 8 --parity = no --stop = 1”

Keep everything else as it is.

2) Update GRUB


3) Under the “Boot Settings” of your linode, change Kernal to “Grub 2”

4) Reboot your Linode


Hey! Thanks for reading :P I just want to let you know that if you enjoyed this, you might also like this post on Sorting.


I'm Bobby Yan, a programmer, music lover and web developer. I am currently working on IB Notes, a website with useful and concise study guides and notes for IB students. I have also built the Spanish Vocabulary Builder iOS app to help Spanish learners.

If you enjoyed this article, you should follow me on Twitter or sign up to get an email whenever I write something new:

Share this article with your friends: