我知道如何配置APT使用web代理。但是snap呢?
$ sudo snap set system proxy.http="http://<proxy_addr>:<proxy_port>"
$ sudo snap set system proxy.https="http://<proxy_addr>:<proxy_port>"
2.34.2
版本,并且这些选项不起作用。只能参考https://askubuntu.com/a/1084862/75760 ,更改systemd设置。 - hanxuesnap version
命令检查您当前的版本。 - DependencyHellsnap 2.37.4+18.04.1
。只是一个小提醒,如果您的密码包含特殊字符,需要进行编码(例如:!
= %21
)。 - Lukehttp://
!(或适用时使用https://
) - Cadoiz/lib/systemd/system/snapd.service
,而是应该使用 systemctl edit snapd.service
。请参考我的回答:http://askubuntu.com/questions/659267/how-do-i-override-or-configure-systemd-services - muru有另一种方法可以向systemd服务添加环境变量:
为snap守护程序创建一个文件夹,并创建环境变量的配置文件:
$ sudo mkdir -p /etc/systemd/system/snapd.service.d/
$ echo -e '[Service]\nEnvironment="http_proxy=http://1.2.3.4:3128/"' \
| sudo tee /etc/systemd/system/snapd.service.d/http-proxy.conf
$ echo -e '[Service]\nEnvironment="https_proxy=http://1.2.3.4:3128/"' \
| sudo tee /etc/systemd/system/snapd.service.d/https-proxy.conf
$ sudo systemctl daemon-reload
$ sudo systemctl restart snapd
snapd
。$ systemctl show snapd | grep proxy
Environment=http_proxy=http://1.2.3.4:3128/ https_proxy=http://1.2.3.4:3128/
DropInPaths=/etc/systemd/system/snapd.service.d/http-proxy.conf /etc/systemd/system/snapd.service.d/https-proxy.conf
sudo vim /etc/sysconfig/snapd
地址:
http_proxy=http://127.0.0.1:3128
https_proxy=http://127.0.0.1:3128
sysconfig
文件夹。 - smartmousehttps://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1579652
请订阅以查看其变化。export https_proxy=http://<your.ip.here>:3128
http://<your.ip.here>:3128