Installation and Use of pip and shadowsocks in CentOS

Source: Internet
Author: User

Installation and Use of pip and shadowsocks in CentOS

Briefly introduce Pip usage (for example, installing Shadowsocks ):
1. install package
Pip install shadowsocks
2. List Installed packages
Pip freeze
3. Install a package of a specific version
Pip install shadowsocks = 1.3.3 ′
Pip install shadowsocks> 1.0, <1.3.3 ′
4. Upgrade the installed package to the latest version.
Pip install-U shadowsocks
5. Uninstall the Installed package
Pip uninstall shadowsocks
6. query installed packages
Pip search "shadowsocks"

Before installing Pip, you must first install setuptools. Before installing setuptools, you must install Python. There is a dependency between the installation processes.

1. Check the Python version.

Python-version
The default Python version installed in CentOS6.5 is 2.6.6, and the returned value is Python 2.6.6.
2. Install setuptools
Yum install-y python-setuptools
After installation, the easy_install command can be used.
3. Install pip
Easy_install pip
Installing pip through easy_install is the easiest way. Pip is installed in the/usr/bin directory by default.
4. Install shadowsocks
Pip install shadowsocks

Configuration and use of Shadowsocks
As for what Shadowsocks can do, I will not go into detail here.
1. Create a configuration file for Shadowsocks:
Run the following command to create the configuration using vim in CentOS:
Vi/etc/shadowsocks. json
The content is as follows:

{"server":"my_server_ip","server_port":7711,"local_address":"127.0.0.1","local_port":1080,"password":"mypassword","timeout":300,"method":"aes-256-cfb","fast_open":false"workers":1}

Meaning of each field:
Server: the IP address of the server (IPv4/IPv6). Note that this will also be the IP address that the server listens.
Server_port: the listening server port
Local_address: IP address of the local listener
Local_port: local port
Password: the password used for encryption
Timeout: timeout (seconds)
Method: encryption method, select bf-cfb, aes-256-cfb, des-cfb, rc4, and so on. The default is an insecure encryption, and the "aes-256-cfb" is recommended"
Fast_open: true or false. If your Server Linux Kernel is 3.7 +, you can enable fast_open to reduce latency. Enabling method:

echo3>/proc/sys/net/ipv4/tcp_fastopen

After enabling, set the fast_open configuration to true.
Works: number of works. The default value is 1.

2. Install M2Crypto

By default, the table encryption method is fast but insecure. Aes-256-cfb or bf-cfb is recommended ". Please do not use "rc4", it is not safe. If you select encryption outside of "table", install M2Crypto.
Install the dependency package first:

yuminstall-yopenssl-develgccswigpython-develautoconflibtool

Install setuptools:

wget--no-check-certificatehttps://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.pypythonez_setup.pyinstall

Then install M2Crypto Through pip:
Pip install M2Crypto

3. Install gevent
Installing gevent can improve the performance of Shadowsocks. Gevent installation in CentOS depends on libevent and greenlet.
Install libevent:
Yum install-y libevent
Install greenlet:
Pip install greenlet
Install gevent:
Pip install gevent

4. command line parameters (server startup command)

Ssserver-c/etc/shadowsocks. json-d start
Ssserver-c/etc/shadowsocks. json-d stop

To keep running Shadowsocks in the background, run the following command:

nohupssserver-c/etc/shadowsocks.json>/dev/null2>&1&

Note: nohup is a command that allows the program to run in the background.

5. Firewall settings (if any)

Edit the firewall configuration file/etc/sysconfig/iptables to allow the server port (server_port.
Add a firewall rule:

-AINPUT-mstate--stateNEW-mtcp-ptcp--dport8989-jACCEPT

6. Client Configuration

The Windows client has a graphical interface and a command line. Here we use the shadowsocks-csharp configuration on the graphical interface as an example.
Download the client shadowsocks-csharp (Latest Version 1.1.2 ):
Https://shadowsocks-csharp.googlecode.com/files/shadowsocks-csharp-1.1.2.zip

Decompress the program to any directory, double-click shadowsocks-csharp.exe to run the program, and fill in the Parameter options:

Server IP: the IP address of the server (IPv4/IPv6). Fill in the IP address (Server) set on the server)
Server Port: Enter the Server Port number (server_port) set on the Server)
Password: the password used for encryption. Enter the Password set on the server)
Proxy Port: the Port of the local Proxy. Enter the local Port (local_port) set on the server)
Encryptor: Specifies the encryption method set on the server)

Note: The Parameters entered by the local client must be consistent with those set by the server.

There is another clientShadowsocks-gui (recommended) Options ,:
Https://sourceforge.net/projects/shadowsocksgui/files/dist/

You can use the browser plug-in to browse foreign websites without any further access. The Setting Process of the plug-in is skipped here.
AutoProxy (for Firefox), Proxy SwitchySharp (for Chrome)

Reference: https://github.com/shadowsocks/shadowsocks

This article from "Huang Yi Shan O & M blog" blog, please be sure to keep this source http://linuxpython.blog.51cto.com/10015972/1658577

Related Article

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.