Centos7安装配置ss客户端

Centos7安装配置ss客户端

注意:这是centos7.4安装配置酸酸(ss)客户端教程

1、配置epel源,安装python-pip

wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum install python-pip
pip install –upgrade pip
1
2
3
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum install python-pip
pip install –upgrade pip

2、安装shadowsocks

pip install shadowsocks
1
pip install shadowsocks

3、创建配置文件

mkdir /etc/shadowsocks
1
mkdir /etc/shadowsocks

vi /etc/shadowsocks/shadowsocks.json
1
vi /etc/shadowsocks/shadowsocks.json
添加以下内容

{
“server”:”69.17.66.77″,
“server_port”:6666,
“local_address”: “127.0.0.1”,
“local_port”:1080,
“password”:”password”,
“timeout”:300,
“method”:”aes-256-cfb”,
“fast_open”: false,
“workers”: 1
}
1
2
3
4
5
6
7
8
9
10
11
{
“server”:”69.17.66.77″,
“server_port”:6666,
“local_address”: “127.0.0.1”,
“local_port”:1080,
“password”:”password”,
“timeout”:300,
“method”:”aes-256-cfb”,
“fast_open”: false,
“workers”: 1
}
备注:
server填写你代理服务器的IP
server_port代理服务器设置的端口
password代理服务器密码
这几个参数很好理解,前提是你了解过并且有ss代理

4、配置自启动

vi /etc/systemd/system/shadowsocks.service
1
vi /etc/systemd/system/shadowsocks.service
添加以下内容

[Unit]
Description=Shadowsocks
[Service]
TimeoutStartSec=0
ExecStart=/usr/bin/sslocal -c /etc/shadowsocks/shadowsocks.json
[Install]
WantedBy=multi-user.target
1
2
3
4
5
6
7
[Unit]
Description=Shadowsocks
[Service]
TimeoutStartSec=0
ExecStart=/usr/bin/sslocal -c /etc/shadowsocks/shadowsocks.json
[Install]
WantedBy=multi-user.target
5、启动shadowsocks客户端

systemctl enable shadowsocks.service
systemctl start shadowsocks.service
systemctl status shadowsocks
1
2
3
systemctl enable shadowsocks.service
systemctl start shadowsocks.service
systemctl status shadowsocks
6、验证

验证shadowsocks客户端是否正常运行,正常会返回你的代理IP

curl –socks5 127.0.0.1:1080 http://httpbin.org/ip
1
curl –socks5 127.0.0.1:1080 http://httpbin.org/ip
7、安装配置privoxy

Shadowsocks是一个socket5服务,我们需要使用privoxy把流量转到http/https上

yum install privoxy
1
yum install privoxy
8、启动privoxy

systemctl enable privoxy
systemctl start privoxy
systemctl status privoxy
1
2
3
systemctl enable privoxy
systemctl start privoxy
systemctl status privoxy
9、配置privoxy

vi /etc/privoxy/config
1
vi /etc/privoxy/config
确保以下两行内容没有被注释掉,forward-socks5t这里端口改成1080,listen-address默认端口不用改

listen-address 127.0.0.1:8118
forward-socks5t / 127.0.0.1:1080 .
1
2
listen-address 127.0.0.1:8118
forward-socks5t / 127.0.0.1:1080 .
10、修改/etc/profile

vi /etc/profile
1
vi /etc/profile
在最下面添加以下内容

export http_proxy=http://127.0.0.1:8118
export https_proxy=http://127.0.0.1:8118
1
2
export http_proxy=http://127.0.0.1:8118
export https_proxy=http://127.0.0.1:8118
使其生效

source /etc/profile
1
source /etc/profile
11、验证

curl www.google.com
1
curl www.google.com
如果可以正常返回内容,即表示配置成功