3

GitHub国内加速:Linux虚拟机利用局域网代理优化访问

 1 year ago
source link: https://51.ruyo.net/18304.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

GitHub国内加速:Linux虚拟机利用局域网代理优化访问

我是小马甲~ • 2023-02-22 • 教程资源, 网络资源 • 567 阅读
GitHub国内加速:Linux虚拟机利用局域网代理优化访问

这是一个系列的文章:GitHub国内加速 介绍多种方案!

最不想更新的文章系列!Github离我们越来越远了!2022年12月Github国内基本上已经全部Q了!

前几天(23年2月18日)Github突然全国都能访问了~ 速度飞起!但只是开心了1天~~~

唉~ 没得办法!

昨天打算在本机VM运行的Linux虚拟机部署nodejs环境。

历史文章:【小白教程】nodejs安装教程指南

[root@localhost ~]# curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.0/install.sh | bash % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 curl: (7) Failed connect to raw.githubusercontent.com:443; Connection refused

安装NVM的时候提示上面的错误!很明显!我们又遇到国内无法访问Github仓库的问题了!

以下内容的前提!你的电脑已经有爬墙软件,且开启了允许局域网访问!!

Network Proxy

CentOS网络设置,有一个网络代理!支持配置各种代理!

a951ae4bdee8cef1.jpg

42964505d4c8b9fe.jpg

设置代理后CentOS自带的浏览器可以正常访问了!

2cdf19b46ac527c1.jpg

但是!终端仍然无法访问Github?

ProxyChains

下面脚本是CentOS 7 部署 proxychains

git clone https://gitee.com/shtml/proxychains-ng.git cd proxychains-ng/ ./configure --prefix=/usr --sysconfdir=/etc make && make install make install-config

安装成功后,可以修改 vim /etc/proxychains.conf

文件最后的配置,保存即可!

[ProxyList] # add proxy here ... # meanwile # defaults set to "tor" #socks4 127.0.0.1 9050 socks5 192.168.8.25 10810

如何让命令走代理呢?只需在命令前添加:proxychains4 即可。

proxychains4 curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.0/install.sh | bash

该使用方式有点像之前介绍的gg代理: GitHub国内加速:在Linux服务器利用gg代理优化访问

Export Proxy

这种方式之前的文章也有提及!历史文章:局域内网的服务器利用跳板机访问互联网

设置当前终端网络代理!命令如下!

export http_proxy=http://192.168.8.119:808 export FTP_PROXY=http://192.168.8.119:808 export ftp_proxy=http://192.168.8.119:808 export all_proxy=socks://192.168.8.119:808 export ALL_PROXY=socks://192.168.8.119:808 export HTTPS_PROXY=http://192.168.8.119:808 export https_proxy=http://192.168.8.119:808 export HTTP_PROXY=http://192.168.8.119:808 export no_proxy=localhost,127.0.0.1

其实这种方式和第一种原理一样!

Network Proxy 仅支持浏览器代理

Export Proxy 仅对当前终端生效

ProxyChains 只要在命令前添加即可走代理

童鞋你还有啥方式分享?请留言吧!


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK