介绍两种linux系统下的安装方法,请根据自身情况选择对应的方式进行安装,我个人是centos,借由朋友的ss服务器来安装成功。主要是当时想安装docker需要能访问外国网站。
一、centos系统
- 安装客户端shadowsocks:
yum install epel-release -y
yum install python-pip
pip install --upgrade pip
pip install shadowsocks
- 新建文件etc/shadowsocks.json (需要提供ss服务器信息)
{
"server":"x.x.x.x", # Shadowsocks服务器地址
"server_port":1035, # Shadowsocks服务器端口
"local_address": "127.0.0.1", # 本地IP
"local_port":1080, # 本地端口
"password":"password", # Shadowsocks连接密码
"timeout":300, # 等待超时时间
"method":"aes-256-cfb", # 加密方式
"fast_open": false, # true或false。开启fast_open以降低延迟,但要求Linux内核在3.7+
"workers": 1 #工作线程数
}
- 启动shadowsocks:
nohup sslocal -c /etc/shadowsocks.json /dev/null 2>&1 &
查看后台sslocal是否运行:
ps aux |grep sslocal |grep -v "grep"
关闭shadowsocks命令:
sslocal -c /etc/shadowsocks.json -d stop
- 安装Privoxy
autoheader && autoconf
./configure
make && make install
改之前备份配置文件
cp /usr/local/etc/privoxy/config /usr/local/etc/privoxy/config.bak
查看/usr/local/etc/privoxy/config
文件,
然后搜索forward-socks5t
,将forward-socks5t / 127.0.0.1:1080
此句的注释去掉.
执行如下命令启动privoxy,参考官网,不同的平台对应不同的方法:
systemctl start privoxy
或/etc/init.d/privoxy start
(要停止则执行:/etc/init.d/privoxy stop
)
5.配置/etc/profile
执行vim /etc/profile
,添加如下三句:
export http_proxy=http://127.0.0.1:8118
export https_proxy=http://127.0.0.1:8118
export ftp_proxy=http://127.0.0.1:8118
二、ubuntu系统
- 安装shadowsocks:
apt-get install shadowsocks
- 首先是安装polipo:
sudo apt-get install polipo
- 启动shadowsocks:
sudo nohup /usr/bin/sslocal -c /etc/shadowsocks.json &
4.配置:
修改polipo的配置文件/etc/polipo/config:
logSyslog = true
logFile = /var/log/polipo/polipo.log
proxyAddress = "0.0.0.0"
socksParentProxy = "127.0.0.1:1080"
socksProxyType = socks5
chunkHighMark = 50331648
objectHighMark = 16384
serverMaxSlots = 64
serverSlots = 16
serverSlots1 = 32
- 启动polipo:
sudo /etc/init.d/polipo restart