[Linux]CentOS與終端破牆


來源:https://www.zybuluo.com/ncepuwanghui/note/954160

參考:https://blog.huihut.com/2017/08/25/LinuxInstallConfigShadowsocksClient/

 

親測在CentOS-7-x86_64-DVD-1804.iso(KDE)上安裝成功

 

一、安裝shadowsocks

安裝epel擴展源
采用Python包管理工pip安裝

sudo yum -y install epel-release
sudo yum -y install python-pip

由於安裝shadowsocks時提示需要jiaja2和pyudev,dnspython的版本要求,所以安裝和更新

ipaclient 4.5.4 requires jinja2, which is not installed.
rtslib-fb 2.1.63 has requirement pyudev>=0.16.1, but you'll have pyudev 0.15 which is incompatible.
ipapython 4.5.4 has requirement dnspython>=1.15, but you'll have dnspython 1.12.0 which is incompatible.

安裝jiaja2

sudo yum -y install python-jinja2

更新pyudev

git clone https://github.com/lunaryorn/pyudev.git
cd pyudev
sudo python setup.py install

更新dnspython

wget http://www.dnspython.org/kits/1.15.0/dnspython-1.15.0.tar.gz
tar -zxvf dnspython-1.15.0.tar.gz
cd dnspython-1.15.0
sudo python setup.py install

 安裝shadowsocks

sudo pip install shadowsocks

如果出現此提示,則按提示更新pip

You are using pip version 8.1.2, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

更新

sudo pip install --upgrade pip

 

二、配置Shadowsocks

新建設置文件

sudo vi /etc/shadowsocks.json
{
    "local_address": "127.0.0.1",
    "local_port":1080,
    "server":"服務器IP",
    "server_port":服務器端口,
    "password":"服務器密碼",
    "timeout":300,
    "method":"aes-256-cfb",
    "fast_open": false,
    "workers": 1
}

2.新建自啟動腳本,設置后開機可以自啟動(注意路徑)

sudo vi /etc/systemd/system/shadowsocks.service
[Unit]
Description=Shadowsocks
[Service]
TimeoutStartSec=0
ExecStart=/usr/bin/sslocal -c /etc/shadowsocks.json
[Install]
WantedBy=multi-user.target

3.啟動

systemctl enable shadowsocks.service
systemctl start shadowsocks.service
systemctl status shadowsocks.service

4.測試,成功時返回shadowsocks的設置IP

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

 

三、配置火狐

 下載安裝FoxyProxy Standard

配置FoxyProxy,填寫IP和端口,選擇socks5,保存

啟用代理

測試

 

四、安裝配置Privoxy

sudo yum -y install privoxy

啟動Privoxy

systemctl enable privoxy
systemctl start privoxy
systemctl status privoxy

配置Privoxy(文本較長,建議其他文本編輯器查找)

sudo vi /etc/privoxy/config

確保如下內容沒有被注釋掉

listen-address 127.0.0.1:8118    #8118是默認端口,不用改
forward-socks5t / 127.0.0.1:1080 .    #轉發到本地端口

添加代理

sudo vi /etc/profile
export http_proxy=http://127.0.0.1:8118
export https_proxy=http://127.0.0.1:8118
source /etc/profile

測試

curl www.google.com

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM