服务器代理
About 1 min
可以连外网的机器
替代方案 Clash https://gist.github.com/kinfables/6db6c745457bc5ab3ce065a741a6fe81
推荐一款轻量级 HTTP/HTTPS 代理 TinyProxy - 腾讯云开发者社区-腾讯云 (tencent.com)
sudo apt-get -y install tinyproxy
主要改下允许连接的主机IP就可以
$ sudo vim /etc/tinyproxy/tinyproxy.conf
# Allow 127.0.0.1
Allow 10.10.6.0/24
Allow 192.168.8.0/24
# 启动 TinyProxy
$ service tinyproxy start
# 停止 TinyProxy
$ service tinyproxy stop
# 重启 TinyProxy
$ service tinyproxy restart
# 测试(无外网机器)
$ curl --proxy 10.16.0.81:8888 -k https://www.hi-linux.com/
内网机器
13
If you are behind a proxy, create a file named .wgetrc in your home directory and add the following lines:
use_proxy=on http_proxy=http://my-proxy.company.net:port https_proxy=http://my-proxy.company.net:port If needed, for one time, add:
check-certificate=off
临时使用:
sudo apt install vim -o Acquire::http::proxy="http://10.16.0.81:8888/"
sudo apt install curl -o Acquire::http::proxy="http://10.16.0.81:8888/"
配置apt
$ sudo vim /etc/apt/apt.conf.d/proxy.conf
Acquire::http::Proxy "http://(<账号>:<密码>@)10.16.0.81:8888";
Acquire::https::Proxy "http://(<账号>:<密码>@)10.16.0.81:8888";
Acquire::http::Proxy "http://10.16.0.81:8888";
Acquire::https::Proxy "http://10.16.0.81:8888";
$ sudo apt-get update
配置系统全局
$ sudo vim /etc/profile
export http_proxy='http://代理服务器IP:端口号'
export https_proxy='http://代理服务器IP:端口号'
export http_proxy='http://10.16.14.14:8888'
export https_proxy='http://10.16.14.14:8888'
$ source /etc/profile
配置conda
$ sudo gedit ~/.condarc
auto_activate_base: false
ssl_verify: true
channels:
- defaults
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
show_channel_urls: true
proxy_servers:
https: http://10.16.0.81:8888
配置pip
pip代理设置:(永久)
如果没有这个文件夹
mkdir $HOME/.config/.pip
sudo gedit $HOME/.config/.pip/pip.conf
添加:(经试验这里pip需要指定http)
[global]
proxy=http://10.16.0.81:8888
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
pip代理:(临时)
pip install scipy==1.1.0 --proxy="http://10.16.0.81:8888"
如果上述pip代理不好使,开启系统代理即可:
1.在bashrc文件中添加export http_proxy="http://127.0.0.1:19964"
2.注意需要保存
miniconda
https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
连接外网
export ALL_PROXY=127.0.0.1:7890