国内编译某些GitHub偶有访问不到仓库的情况,需要使用魔法。目前情况是主机已经魔法了,让虚拟机能用上。
以Windows 11环境为例,配置魔法软件打开允许局域网连接。其他不变,参考
然后就是VMware 配置虚拟机以NAT8方式访问网络
这里使用的VMware默认的na8,网关是192.168.79.1。
在Ubuntu的用户目录编辑.bashrc配置文件
cd ~
vi .bashrc
最末尾添加以下配置
#
export http_proxy="http://192.168.79.1:10809/"
export https_proxy="http://192.168.79.1:10809/"
export ftp_proxy="http://192.168.79.1:10809/"
export no_proxy="127.0.0.1,localhost"
# For curl
export HTTP_PROXY="http://192.168.79.1:10809/"
export HTTPS_PROXY="http://192.168.79.1:10809/"
export FTP_PROXY="http://192.168.79.1:10809/"
export NO_PROXY="127.0.0.1,localhost"
执行source刷新变量
source .bashrc
测试
wget www.google.com
能下载index.html则成功
https://www.leftso.com/article/2405291634014805.html