CentOS6.5 Installation Configuration Shadowsocks service-side Complete tutorial

Source: Internet
Author: User
Tags json openssl save file iptables server port in python


Shadowsocks is a lightweight tunneling socks5 agent, which encrypts network channels.

System CentOS6.5 x86, built-in Python version 2.6.6 (can be viewed with python-v command)

Preparation: Installing the required components

Yum install wget tar gcc gcc-c++ OpenSSL openssl-devel pcre-devel python-devel libevent-y

First, upgrade Python
1. Follow the steps below

Cd/root
wget http://www.python.org/ftp/python/2.7.6/Python-2.7.6.tgz
Tar zxvf python-2.7.6.tgz
CD Python-2.7.6
./configure
Make & make Install

2, set python2.7.6 as the default version, here python2.6.6 for the system built version, do not know the current version can use the PYTHON-V command to view

mv/usr/bin/python/usr/bin/python2.6.6
Ln-s/usr/local/bin/python2.7/usr/bin/python
After the modification can be python-v to see if the success

3, because Yum rely on built-in python, so need to modify the Yum dependency

Vi/usr/bin/yum
Note: Press I into edit mode, the first line #!/usr/bin/python to #!/usr/bin/python2.6.6, the latter for the built-in Python version, and then press ESC to exit edit mode, press shift+:, input Wq save file can ~

Second, install Pip
1, installation Setuptools (PIP need this), followed by the implementation

Cd/root
wget http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg–no-check-certificate
SH Setuptools-0.6c11-py2.7.egg

If prompted Zipimport. Zipimporterror:can ' t decompress data; Zlib not available, which describes the need to install the Zlib library

Cd/root/python-2.7.6/modules/zlib
./configure
Make & make Install

Recompile python

cd/root/python-2.7.6
Make & make Install

Install Setuptools

Cd/root
SH Setuptools-0.6c11-py2.7.egg

2. Install Pip

Cd/root
wget http://pypi.python.org/packages/source/p/pip/pip-1.5.4.tar.gz–no-check-certificate
Tar zxvf pip-1.5.4.tar.gz
CD pip-1.5.4
Python setup.py Install

Iii. installation of Shadowsocks
Because the PIP is installed, it's very simple, a line of command

Pip Install Shadowsocks

Running Shadowsocks is not recommended at this time

Iv. installation of M2crypto
Shadowsocks supports the following encryption methods:

AES-128-CFB, AES-192-CFB, AES-256-CFB, BF-CFB, CAMELLIA-128-CFB, CAMELLIA-192-CFB, CAMELLIA-256-CFB, CAST5-CFB, DES-CFB, IDEA-CFB, RC2-CFB, RC4, SEED-CFB, table

Default encryption Method table is very fast, but very unsafe, the recommended use of "AES-256-CFB" or "BF-CFB", the use of encryption must be installed M2crypto.

1. Installation Swig
Yum Swig version is too old, if the use of Yum installation is basically a pit, if the system integration will have the same problem
First check the Swig version, if the 1.x version of the first uninstall off

Swig-version

Execute the following command

Cd/root
wget http://jaist.dl.sourceforge.net/project/swig/swig/swig-3.0.0/swig-3.0.0.tar.gz
Tar zxvf swig-3.0.0.tar.gz
CD swig-3.0.0
./configure
Make & make Install

When the installation is complete, you can view the version

Swig-version

2. Installation M2crypto

Cd/root
wget https://pypi.python.org/packages/source/m/m2crypto/m2crypto-0.22.3.tar.gz–no-check-certificate
Tar zxvf m2crypto-0.22.3.tar.gz
CD m2crypto-0.22.3
Python setup.py Build
Python setup.py Install

V. Installation of Gevent
Install gevent can get better performance, no matter how the effect, or put a bar ...
1. Install Easy_install and install Greenlet

Cd/root
Wget-q http://peak.telecommunity.com/dist/ez_setup.py
Python ez_setup.py
Easy_install Greenlet

2, install gevent (small memory VPS may not be able to pass)

Cd/root
wget http://pypi.python.org/packages/source/g/gevent/gevent-0.13.8.tar.gz
Tar zxvf gevent-0.13.8.tar.gz
CD gevent-0.13.8
Python setup.py Build
Python setup.py Install

Vi. operation of Shadowsocks
1. Create a file named "Config.json" under any directory and edit the text

Touch Config.json
VI Config.json

2, set the Shadowsocks server, press I to enter the editor, the following content into the text, edit finished press ESC to exit the edit, and then shift+:, enter Wq save

{
"Server": "My_server_ip",
"Server_port": 1024,
"Local_port": 1989,
"Password": "Lolicon",
"Timeout": 600,
"Method": "AES-256-CFB"
}

Meaning of each field:

Server server IP (ipv4/ipv6), note that this will also be the IP address that the service side listens to
Server_port Server Port
Local_port Local Port
Password used by password to encrypt
Timeout timeout (seconds)
Method of encryption, you can choose "BF-CFB", "AES-256-CFB", "DES-CFB", "Rc4″, and so on." Default is an unsecured encryption, recommended by the "AES-256-CFB"

3, in the Config.json file directory execution

Ssserver (front run)
Nohup ssserver > Log & (running in the background)

4, if successfully run, but can not connect, may be the iptables settings, you can choose to add the current port to the whitelist or close iptables resolution

Please change "1024" to the server port you set up.
Iptables-i input-p tcp-m tcp–dport 1024-j ACCEPT
Service Iptables Save (recommended)
or close iptables (not recommended)
/etc/rc.d/init.d/iptables stop

5, the client set up a search on the internet a lot

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.