pocopico / tinycore-redpill

GNU General Public License v3.0
2.17k stars 636 forks source link

a way to use proxy in tinycore-redpill(TCRP)/在tinycore-redpill(TCRP)中使用代理 #80

Open xana2333 opened 2 years ago

xana2333 commented 2 years ago

This is for the user who must use proxy to access internet/github/google setPROXY.sh.txt

  1. Create the setPROXY.sh script touch setPROXY.sh

  2. Prepare script content You need to change the value of myproxy with your proxy setting. It accect 2 way: http and socks5. like this

    myproxy="http://[user]:[pwd]@[IP]:[port]" eg:myproxy="http://myusername:mypwd@192.168.1.1:8080" eg:myproxy="http://192.168.1.1:8080"

    myproxy="socks5://[user]:[pwd]@[IP]:[port]" eg:myproxy="socks5://myusername:mypwd@192.168.1.1:8080" eg:myproxy="socks5://192.168.1.1:8080"

This is a template of setPROXY.sh

 #!/bin/bash

myproxy="http://192.168.1.1:8080"

echo -e "curl and git's proxy will set to \033[1m$myproxy\033[0m"

#set proxy for current user's curl
echo "proxy=\"$myproxy\"" > $HOME/.curlrc
#set proxy for root's curl
echo "proxy=\"$myproxy\"" > /root/.curlrc

set proxy for git
git config --global http.proxy $myproxy
  1. Using vi to change setPROXY.sh vi setPROXY.sh This is another correct sample of setPROXY.sh
    
    #!/bin/bash

myproxy="socks5://192.168.1.1:8080"

echo "proxy=\"$myproxy\"" > $HOME/.curlrc echo "proxy=\"$myproxy\"" > /root/.curlrc

git config --global http.proxy $myproxy


After finishing editing, press "ESC" key, then enter ":wq" to save the file and exit (by:@wd4455 )

5. Run `setPROXY.sh`
`bash setPROXY.sh`
If there is no output from the shell, the proxy settings are in effect

Sorry about my English level, I hope it can help someone
xana2333 commented 2 years ago

这适用于必须要通过代理才能访问 internet/github/google 的情况 setPROXY.sh.txt

  1. 创建 setPROXY.sh 脚本 touch setPROXY.sh

  2. 准备脚本内容 你需要根据你的代理设置修改变量 myproxy 它支持2种协议: http and socks5 参考写法如下

    myproxy="http://[user]:[pwd]@[IP]:[port]" eg:myproxy="http://myusername:mypwd@192.168.1.1:8080" eg:myproxy="http://192.168.1.1:8080"

    myproxy="socks5://[user]:[pwd]@[IP]:[port]" eg:myproxy="socks5://myusername:mypwd@192.168.1.1:8080" eg:myproxy="socks5://192.168.1.1:8080"

这是 setPROXY.sh 的模版

 #!/bin/bash

myproxy="http://192.168.1.1:8080"

echo -e "curl and git's proxy will set to \033[1m$myproxy\033[0m"

#set proxy for current user's curl
echo "proxy=\"$myproxy\"" > $HOME/.curlrc
#set proxy for root's curl
echo "proxy=\"$myproxy\"" > /root/.curlrc

set proxy for git
git config --global http.proxy $myproxy
  1. 使用 vi 编辑 setPROXY.sh vi setPROXY.sh 这是另一个正确的 setPROXY.sh脚本,需要根据你的需要修改myproxy变量
    
    #!/bin/bash

myproxy="socks5://192.168.1.1:8080"

echo "proxy=\"$myproxy\"" > $HOME/.curlrc echo "proxy=\"$myproxy\"" > /root/.curlrc

git config --global http.proxy $myproxy


完成编辑后按“ESC”键,再输入":wq"保存文件退出 (by:@wd4455 )

5. 运行`setPROXY.sh`
`bash setPROXY.sh`
如果shell没有输出,那说明代理设置成功了。
wd4455 commented 2 years ago

用vi编辑文件后按「ESC」键,再输入:wq即可保存退出

Kazagumo commented 2 years ago

很有帮助!

1004452714 commented 2 years ago

对于linux小白很有用!感谢!