Set up Your Own Shadowsocks Server On Debian, Ubuntu, CentOS

Lenz

Nobility
Staff member
Moderator
Joined
Nov 8, 2018
Messages
840
Reaction Score
967
Points
95
Location
Cebu
881


[SIZE=4]Shadowsocks is an open source socks5 proxy that can be used to bypass firewall and unblock websites. Originally developed by a Chinese called
You do not have permission to view link Log in or register now.
, now the application has been implemented in all kinds of programming languages such as C, C++, Go, Python and the like. This Tutorial will guide you through setting up your own Shadowsocks server and how to use it on your desktop computer, android and iOS. I assume you already have access to a VPS or dedicated server.
[/SIZE]
[SIZE=5]Shadowsocks VS VPN[/SIZE]

[SIZE=4]As you may already know, you can use VPN (Virtual Private Network) to bypass firewall and protect your anonymity on the web. Do you need another software like shadowsocks to do the same? One thing you can find is that When you are using VPN, all your Internet traffic is routed through VPN. Because VPN servers are usually located outside your country, this can slow down your Internet speed especially when you are visiting websites inside your country.

Shadowsocks comes to the rescue! Besides a global proxy setting, shadowsocks can also be setup in a way that some of your applications go through shadowsocks and other applications go through normal traffic. For example, you can use Google Chrome to bypass firewall, visit Google, Facebook, YouTube and use Firefox to visit sites that isn’t blocked in your area.

By the way, shadowsocks client will automatically reconnect to shadowsocks server if there’s a disconnect. Although you can configure VPN client to do the same, but that will take extra work.
[/SIZE]
[SIZE=5]Setting Up Shadowsocks on Your Server[/SIZE]

[SIZE=4]There are many ways to install shadowsocks on Linux server, but I will show you the easiest way. First, install python pip and then use pip to install shadowsocks. m2crypto will make encryption a little faster.


Debian /Ubuntu

sudo apt-get install python-pip python-m2crypto
sudo pip install shadowsocks
CentOS/RHEL

sudo yum install m2crypto python-setuptools
sudo easy_install pip
sudo pip install shadowsocks
Create a configuration file with a command line text editor like nano.

sudo nano /etc/shadowsocks.json
Put the following text into the file.

{
"server":"your_server_ip",
"server_port":8000,
"local_port":1080,
"password":"your_passwd",
"timeout":600,
"method":"aes-256-cfb"
}

Explanation of each field:
[/SIZE]
  • [SIZE=4]server: your hostname or server IP (IPv4/IPv6).[/SIZE]
  • [SIZE=4]server_port: server port number.[/SIZE]
  • [SIZE=4]local_port: local port number.[/SIZE]
  • [SIZE=4]password: a password used to encrypt transfer.[/SIZE]
  • [SIZE=4]timeout: connections timeout in seconds.[/SIZE]
  • [SIZE=4]method: encryption method, “bf-cfb”, “aes-256-cfb”, “des-cfb”, “rc4”, etc. Default is table, which is not secure. “aes-256-cfb” is recommended.[/SIZE]
[SIZE=4]Replace the green text with your info. Save and close the file, then start shadowsocks server.

sudo ssserver -c /etc/shadowsocks.json -d start
To stop shadowsocks server:

sudo ssserver -d stop
Restart Shadowsocks server:

sudo ssserver -c /etc/shadowsocks.json -d restart
Check Shadowsocks log

less /var/log/shadowsocks.log
If necessary, you can always manually download the python version from
You do not have permission to view link Log in or register now.
.

You may need to allow traffic through your Shadowsocks server port in iptables firewall by running command: sudo iptables -I INPUT -p tcp --dport 8000 -j ACCEPT
[/SIZE]
[SIZE=5]Auto Start on System Boot[/SIZE]

[SIZE=4]If you want shadowsocks server to automatically start on system boot, then edit /etc/rc.local file

sudo nano /etc/rc.local
Add the following line to the file above exit 0 line

/usr/bin/python /usr/local/bin/ssserver -c /etc/shadowsocks.json -d start
[/SIZE]
 

NEW THREADS

Top