一、申請國外伺服器,部署ShadowSock服務 1、下載並創建配置文件 2、打開防火牆對應埠 3、設置自啟動 二、安裝客戶端 三、安裝socket5轉http代理工具 四、啟用或停用全局http/https代理 五、使用更靈活的代理方式 用法:在需要代理的命令前加上 proxychains4 , ...
一、申請國外伺服器,部署ShadowSock服務
1、下載並創建配置文件
wget https://github.com/shadowsocks/shadowsocks-go/releases/download/1.2.1/shadowsocks-server.tar.gz tar -zxf shadowsocks-server.tar.gz cd shadowsocks-server cat > config.json <<EOF { "server":"127.0.0.1", "server_port":8888, "local_port":1080, "local_address":"127.0.0.1", "password":"yourpassword", "method": "aes-256-cfb", "timeout":600 } EOF
2、打開防火牆對應埠
systemctl status firewalld firewall-cmd --permanent --zone=public --add-port=8888/tcp firewall-cmd --permanent --zone=public --add-port=8888/udp firewall-cmd --reload
3、設置自啟動
cat > /lib/systemd/system/shadowsocks.service <<EOF [Unit] Description=ShadowSocksServer After=network.target [Service] ExecStart=/shadowsocks-server/shadowsocks-server -c /shadowsocks/config.json >>shadowsocks-`date +%Y-%m`.log & ExecStop=kill -9 `ps -au | grep -v grep |grep shadowsocks-server | awk '{print $2}'` >>shadowsocks-`date +%Y-%m`.log [Install] WantedBy=multi-user.target EOF systemctl start shadowsocks systemctl enable shadowsocks
二、安裝客戶端
yum install python-pip pip install shadowsocks pip install --upgrade pip pip install shadowsocks cat > /etc/shadowsocks.json <<EOF { "server":"yourserver", "server_port":8888, "local_address":"127.0.0.1", "local_port":1080, "password":"yourpassword", "timeout":300, "method":"aes-256-cfb", "fast_open": false } EOF sslocal -c /etc/shadowsocks.json -d start #sslocal -c /etc/shadowsocks.json -d stop
三、安裝socket5轉http代理工具
yum install privoxy echo forward-socks5 / 127.0.0.1:1080 . >> /etc/privoxy/config systemctl restart privoxy
四、啟用或停用全局http/https代理
export http_proxy=http://localhost:8118 export https_proxy=https://localhost:8118 #unset http_proxy #unset https_proxy
五、使用更靈活的代理方式
yum -y install gcc wget http://ftp.barfooze.de/pub/sabotage/tarballs/proxychains-ng-4.13.tar.xz tar -xvf proxychains-ng-4.13.tar.xz cd proxychains-ng-4.13 ./configure make && make install cp ./src/proxychains.conf /etc/proxychains.conf vi /etc/proxychains.conf #將socks4 127.0.0.1 9095改為socks5 127.0.0.1 1080
用法:在需要代理的命令前加上 proxychains4 ,如:proxychains4 curl www.google.com