两个版本选择

安装配置 Shadowsocks(python版本)

安装 YUM 源和编译链

1
yum install -y epel-release curl gcc gettext autoconf libtool automake make pcre-devel asciidoc xmlto udns-devel libev-devel mbedtls-devel libsodium-devel c-ares-devel

安装 pip

1
yum install -y python-pip

创建 pip 源

1
2
3
4
5
6
mkdir /root/.pip
cat > /root/.pip/pip.conf << EOF
[global]
trusted-host =  pypi.douban.com
index-url = http://pypi.douban.com/simple
EOF

升级 pip

1
pip install --upgrade pip

安装 shadowsocks-3.0

1
pip install https://github.com/shadowsocks/shadowsocks/archive/master.zip -U

安装shadowsocks-libev版本

1
2
3
4
5
6
7
8
cd /usr/local/src
git clone https://github.com/shadowsocks/shadowsocks-libev.git
cd shadowsocks-libev
git submodule update --init --recursive

./autogen.sh
./configure
make && make install

创建 shadowsocks 配置文件

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
mkdir /etc/shadowsocks
cat > /etc/shadowsocks/shadowsocks.json << EOF
{
    "server":"SS 服务端 IP",
    "server_port":SS 服务端端口,
    "local_address": "127.0.0.1",
    "local_port":1080,
    "password":"SS 服务端密码",
    "timeout":300,
    "method":"aes-256-gcm",
    "fast_open": false,
    "workers": 1
}
EOF

创建 shadowsocks 服务(python版本)

1
2
3
4
5
6
7
8
9
cat > /etc/systemd/system/shadowsocks.service << EOF
[Unit]
Description=Shadowsocks
[Service]
TimeoutStartSec=0
ExecStart=/usr/bin/sslocal -c /etc/shadowsocks/shadowsocks.json
[Install]
WantedBy=multi-user.target
EOF

启动 shadowsocks 服务

1
2
3
systemctl enable shadowsocks.service
systemctl start shadowsocks.service
systemctl status shadowsocks

创建 shadowsocks 服务(libev版本)

1
2
3
4
5
6
7
8
9
[Unit]
Description=Shadowsocks Client

[Service]
TimeoutStartSec=0
ExecStart=/usr/local/bin/ss-local -c /etc/shadowsocks/shadowsocks.json

[Install]
WantedBy=multi-user.target

启动 shadowsocks-libev 服务

1
2
3
systemctl enable shadowsocks.service
systemctl start shadowsocks.service
systemctl status shadowsocks

检查 shadowsocks 客户端配置,正常会返回 shadowsocks 服务端 IP

1
curl --socks5 127.0.0.1:1080 http://httpbin.org/ip

全局代理工具

安装配置 privoxy

YUM 安装 privoxy

1
yum install privoxy

修改 privoxy 配置文件 /etc/privoxy/config

1
2
listen-address 127.0.0.1:8118
forward-socks5t / 127.0.0.1:1080 .

启动 privoxy 服务

1
2
3
systemctl enable privoxy
systemctl start privoxy
systemctl status privoxy

设置代理环境变量

1
2
3
echo -e "export http_proxy=http://127.0.0.1:8118" >> /etc/profile
echo -e "export https_proxy=http://127.0.0.1:8118" >> /etc/profile
source /etc/profile

测试访问 GG

1
curl www.google.com

一键安装proxychains-ng

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh
# Usage:
#   wget -O- https://gist.githubusercontent.com/ifduyue/dea03b4e139c5758ca114770027cf65c/raw/install-proxychains-ng.sh | sudo bash -s

set -eu

version=4.13
wget https://github.com/rofl0r/proxychains-ng/archive/v$version.tar.gz
tar xf v$version.tar.gz


(cd proxychains-ng-$version
 ./configure
 make
 make install
 [[ -f /etc/proxychains.conf ]] || cp src/proxychains.conf /etc/proxychains.conf
)

rm -rf v$version.tar.gz proxychains-ng-$version

编辑配置文件/etc/proxychains.conf,在[ProxyList]下添加如下代码

1
socks5 127.0.0.1 1080