Deploy Shadowsocks service on Linux

Linux部署Shadowsocks服务

These past few days, I reinstalled Linux and wanted to avoid using GUI for SS. The information online wasn’t very useful, so I experimented a bit.

Installation Environment

(Dependencies: Python)

1
sudo apt-get install build-essential python-pip python-m2crypto python-dev python-gevent supervisor

Then execute:

1
sudo pip install shadowsocks 

Creating config.json File

Next, find the path /usr/local/lib/python2.7/dist-packages/shadowsocks and create a file named config.json, copy the following code into it, and modify your SS service configuration.

1
2
3
4
5
6
7
8
{
"server" : "your server IP",
"server_port" : your server port,
"password" : "your password",
"method" : "aes-256-cfb",
"local_port":1080,
"timeout":600
}

Note
If you want to use salsa20 or chacha20 or chacha20-ietf algorithms, please install libsodium (if using aes-256-cfb, you can skip this part).
Compile and install:

1
2
3
4
5
apt-get install build-essential
wget https://github.com/jedisct1/libsodium/releases/download/1.0.8/libsodium-1.0.8.tar.gz
tar xf libsodium-1.0.8.tar.gz && cd libsodium-1.0.8
sudo ./configure && make -j2 && make install
ldconfig

After saving, you can temporarily start it.
(The terminal path is still in /usr/local/lib/python2.7/dist-packages/shadowsocks)

1
python ./local.py -c ./config.json 


This is considered a successful run.

After configuring the plugin (SwitchyOmega) in Chrome, run the following (SS proxy):

(The SwitchyOmega configuration will be attached later)

However, it’s quite cumbersome to navigate directories and enter commands every time at startup.

Setting SS Service to Start on Boot

1
sudo gedit /etc/rc.local

The initial content of this file is:

1
2
#!/bin/sh -e
exit 0

We need to add the command to start the SS service (scripts and configuration files must use absolute paths).

1
2
3
#!/bin/sh -e
python /usr/local/lib/python2.7/dist-packages/shadowsocks/local.py -c /usr/local/lib/python2.7/dist-packages/shadowsocks/config.json
exit 0

After saving, the SS service will automatically start after rebooting the system.

SwitchyOmega Settings


The gfwlist project has migrated to GitHub: gfwlist
Auto Switch rule list:
https://raw.githubusercontent.com/gfwlist/gfwlist/master/gfwlist.txt

The article is finished. If you have any questions, please comment and communicate.

Scan the QR code on WeChat and follow me.

Title:Deploy Shadowsocks service on Linux
Author:LIPENGZHA
Publish Date:2015/08/26 17:31
Word Count:1.2k Words
Link:https://en.imzlp.com/posts/23429/
License: CC BY-NC-SA 4.0
Reprinting of the full article is prohibited.
Your donation will encourage me to keep creating!