ubunutu下代理设置

部署运行你感兴趣的模型镜像

很多情况下,在公司中会使用代理访问外网。

在Ubuntu16.04下面,先“系统设置->网络->网络代理”中,改成手动,然后添加上四个代理地址和端口。

然后代理文件在 /etc/apt/apt.conf 下,增加用户名和密码。

命令为 sudo vim /etc/apt/apt.conf,因为为系统文件,所以要sudo

修改为:

Acquire::http::proxy "http://test:test@1.1.1.1/";
Acquire::https::proxy "https://test:test@1.1.1.1/";
Acquire::ftp::proxy"ftp://test:test@1.1.1.1/";
Acquire::socks::proxy "socks://test:test@1.1.1.1/";


您可能感兴趣的与本文相关的镜像

TensorFlow-v2.9

TensorFlow-v2.9

TensorFlow

TensorFlow 是由Google Brain 团队开发的开源机器学习框架,广泛应用于深度学习研究和生产环境。 它提供了一个灵活的平台,用于构建和训练各种机器学习模型

所给引用内容未提及在WSL2的Ubuntu 20.04系统中进行代理设置的方法。一般而言,在WSL2的Ubuntu 20.04系统中进行代理设置可以通过以下几种常见方式: ### 临时命令行设置 在终端中临时设置代理,仅对当前终端会话有效。以HTTP和HTTPS代理为例: ```bash export http_proxy=http://proxy_address:proxy_port export https_proxy=http://proxy_address:proxy_port ``` 如果代理需要用户名和密码: ```bash export http_proxy=http://username:password@proxy_address:proxy_port export https_proxy=http://username:password@proxy_address:proxy_port ``` 若要取消临时代理设置: ```bash unset http_proxy unset https_proxy ``` ### 全局环境变量设置 修改`~/.bashrc`或`~/.zshrc`文件(取决于使用的shell),使代理设置对所有终端会话有效。 打开相应的文件: ```bash nano ~/.bashrc ``` 在文件末尾添加以下内容: ```bash export http_proxy=http://proxy_address:proxy_port export https_proxy=http://proxy_address:proxy_port ``` 保存并退出文件,然后使修改生效: ```bash source ~/.bashrc ``` ### APT代理设置 如果需要为`apt`包管理器设置代理,编辑`/etc/apt/apt.conf.d/99proxy`文件(如果文件不存在则创建): ```bash sudo nano /etc/apt/apt.conf.d/99proxy ``` 添加以下内容: ```plaintext Acquire::http::Proxy "http://proxy_address:proxy_port"; Acquire::https::Proxy "http://proxy_address:proxy_port"; ``` ### Git代理设置 如果使用Git,需要为Git设置代理: ```bash git config --global http.proxy http://proxy_address:proxy_port git config --global https.proxy http://proxy_address:proxy_port ``` 若要取消Git代理设置: ```bash git config --global --unset http.proxy git config --global --unset https.proxy ```
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值