Intro

What is SOCKS5?

What is Shadowsocks?

Before You Begin

You need:

  1. a linux vps
  2. a user with sudo privileges
  3. a working firewall(UFW, iptables, FirewallD) for safety

Install the Shadowsocks Server (the new & easy way)

Install using apt

Install from repository Shadowsocks-libev is available in the official repository for following distributions:

Debian 8 or higher, including oldstable (jessie), stable (stretch), testing (buster) and unstable (sid) Ubuntu 16.10 or higher

sudo apt update
sudo apt install shadowsocks-libev

Setup

configure and change the params of the default ss config file

sudo vim /etc/shadowsocks/shadowsocks.json

enable and restart service

sudo systemctl enable shadowsocks-libev
sudo systemctl restart shadowsocks-libev

check out the firewall and make sure the port is open, and you are good to go!

Install the Shadowsocks Server (the old way, just kept as reference)

Install the manual way

  1. Update system, install dependencies Ubuntu 16.06 or above
    sudo apt update && sudo apt upgrade -yuf
    sudo apt install -y --no-install-recommends gettext build-essential autoconf libtool libpcre3-dev \
                                        asciidoc xmlto libev-dev libudns-dev automake libmbedtls-dev \
                                        libsodium-dev git python-m2crypto libc-ares-dev
    
  2. Download Shadowsocks
    git clone https://github.com/shadowsocks/shadowsocks-libev.git
    cd shadowsocks-libev
    git submodule update --init --recursive
    
  3. Install Shadowsocks-libev
    ./autogen.sh
    ./configure
    make && sudo make install
    

Configure the Shadowsocks Server

  1. Create user and dir
    sudo adduser --system --no-create-home --group shadowsocks
    sudo mkdir -m 755 /etc/shadowsocks
    
  2. Create Shadowsocks config file File: /etc/shadowsocks/shadowsocks.json
    {
     "server":"0.0.0.0",
     "server_port":8388,
     "password":"yourpassword",
     "timeout":300,
     "method":"aes-256-gcm",
     "fast_open": true
    }
    

Create a Shadowsocks Systemd Service

File: /etc/systemd/system/shadowsocks.service

[Unit]
Description=Shadowsocks proxy server

[Service]
User=root
Group=root
Type=simple
ExecStart=/usr/local/bin/ss-server -c /etc/shadowsocks/shadowsocks.json -a shadowsocks -v start
ExecStop=/usr/local/bin/ss-server -c /etc/shadowsocks/shadowsocks.json -a shadowsocks -v stop

[Install]
WantedBy=multi-user.target

Enable and Start shadowsocks.service:

sudo systemctl daemon-reload
sudo systemctl enable shadowsocks
sudo systemctl start shadowsocks

Open Firewall Port to Shadowsocks Client

UFW

sudo ufw allow proto tcp to 0.0.0.0/0 port 8388 comment "Shadowsocks server listen port"

Reference

  1. https://linode.com/docs/networking/vpn/create-a-socks5-proxy-server-with-shadowsocks-on-ubuntu-and-centos7/