Shadowsocks build environment under Centos7

Copyright: MZ21G https://blog.csdn.net/qq_35793285/article/details/81627229

Server-side: centos7

Client: centos7

ShadowSocks regardless of the client service side, depending on the start command: ssserver start the server, sslocal start the client

**************************** *********************** server installation ************************ ***********************************

Connect to the server by using the "ssh + ip address" client

ssh xxxx.xxxx.xxxx.xxxx

1. Install pip

1.1 Installation epel extended source

sudo yum install epel-release

1.2 Installation python-pip

sudo yum -y install python-pip

1.3 Upgrade pip

sudo pip install --upgrade pip

Display Complete! Said after the successful installation, it is best to clear the next cache.

sudo yum clean all

2. Install shdowsocks

 pip install shadowsocks

2.1 configuration server

Create a new profile

vim /etc/shadowsocks/config.json

Writes the following:

{
    "server":"0.0.0.0",      // 服务端写为“0.0.0.0”
    "server_port":8388,      // 服务器端口
    "local_port":1080,       // 本地端口
    "password":"xxxxx",      // 隧道连接密码
    "timeout":600,           // 连接超时时间
    "method":"aes-256-cfb"   // 隧道使用协议
}

Multi-user support can be set as follows:

{
    "server":"0.0.0.0",    //服务器端写为”0.0.0.0“
    "port_password":{      //多用户配置
        "port_1":"pwd1",   //用户一:”服务器端口+隧道连接密码“
        "port_2":"pwd2",   //用户二:“服务器端口+隧道连接密码”
        "port_3":"pwd3"    //用户三:“服务器端口+隧道连接密码”
    },
    "local_port":1080,     //本地端口
    "timeout":600,         //连接超时时间
    "method":"aes-256-cfb" //隧道使用协议
}

The main need to set server_ip, port and password three, save and exit after the set.

2.2 Starting shadowsocks

It is best to set the service to start.

vi /etc/systemd/system/shadowsocks.service

Then enter the following:

[Unit]
Description=Shadowsocks
After=network.target

[Service]
TimeoutStartSec=0
ExecStart=/usr/bin/ssserver -c /etc/shadowsocks/config.json
 
[Install]
WantedBy=multi-user.target

Start the service:

systemctl enable shadowsocks
systemctl start shadowsocks

Check whether the service started successfully:

systemctl status shadowsocks -l

If you need to stop using the service:

systemctl stop shadowsocks

 

************************************************** * client installation ********************************************** *************
installation ShadowSocks

pip install shadowsocks

New Profile

vim /etc/shadowsocks/config.json

Writes the following

{
    "server":"xxx.xxx.xxx.xxx", // 上面配置的服务端的IP地址
    "server_port":8388,         // 服务器端口
    "local_port":1080,          // 本地端口
    "password":"xxxxx",         // 隧道连接密码
    "timeout":600,              // 连接超时时间
    "method":"aes-256-cfb"      // 隧道使用协议
}

Start ShadowSocks client

sudo sslocal -c /etc/shadowsocks/config.json -d start

The client is configured to start with the system, edit or /etc/rc.d /etc/rc.local file, enter before exit 0:

sudo sslocal -c /etc/shadowsocks/config.json -d start

As shown below:


 

******************************************** global proxy client settings * *************************************************
installation Privoxy

sudo yum install privoxy

Configure Privoxy

sudo vim /etc/privoxy/config

: 783: found 783 line, remove the front comment symbol, the port can easily change

listen-address 127.0.0.1:8118

: 1336: 1336 to find the line, remove the front annotation symbol 1080 corresponding to the port to configure which services ss behind, to be consistent

forward-socks5t / 127.0.0.1:1080 .

Configure the terminal to go Agent

sudo vim /ect/profile

In the end of the file writes the following:

export https_proxy=http://127.0.0.1:8118
export http_proxy=http://127.0.0.1:8118
export ftp_proxy=http://127.0.0.1:8118

The environment variable is set to take effect

source /etc/profile

Start Privoxy agent

sudo service privoxy start

Whether the test agent success

curl www.google.com 

Successful, it will return a lot of information

************************************* set the CentOS yum to use the proxy ******* *******************************************

vim /etc/yum.conf 

# Add the following content

proxy=http://127.0.0.1:8118/

 

Reference article:

https://blog.csdn.net/u013309540/article/details/74330305

https://blog.csdn.net/aishangyutian12/article/details/78255577

 

 

Guess you like

Origin blog.csdn.net/qq_35793285/article/details/81627229