3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【備忘】Ubuntu proxy設定

Last updated at Posted at 2021-01-27

環境変数

export http_proxy=<proxyのURL>
export no_proxy=<no_proxyのホスト>

cat <<EOF | sudo tee /etc/profile.d/proxy.sh
export http_proxy=${http_proxy}
export https_proxy=\${http_proxy}
export HTTP_PROXY=\${http_proxy}
export HTTPS_PROXY=\${http_proxy}
export no_proxy=${no_proxy}
export NO_PROXY=\${no_proxy}
EOF
source /etc/profile.d/proxy.sh

Apt

export http_proxy=<proxyのURL>

cat <<EOF | sudo tee /etc/apt/apt.conf.d/90proxy
Acquire::http::Proxy "${http_proxy}";
Acquire::https::Proxy "${http_proxy}";
EOF

Snap

export http_proxy=<proxyのURL>

sudo snap set system proxy.http=${http_proxy}
sudo snap set system proxy.https=${http_proxy}

確認方法

sudo snap get system proxy.http
sudo snap get system proxy.https

Docker

export http_proxy=<proxyのURL>
export no_proxy=<プライベートリポジトリがあれば、そのホストを指定>

sudo mkdir /etc/systemd/system/docker.service.d
cat <<EOF | sudo tee /etc/systemd/system/docker.service.d/http-proxy.conf
[Service]
Environment="HTTP_PROXY=${http_proxy}"
Environment="HTTPS_PROXY=${https_proxy}"
Environment="NO_PROXY=${no_proxy}"
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker.service

containerd

export http_proxy=<proxyのURL>
export no_proxy=<プライベートリポジトリがあれば、そのホストを指定>

cat <<EOF | sudo tee /etc/systemd/system/containerd.service.d/http-proxy.conf
[Service]
Environment="HTTP_PROXY=${http_proxy}" "HTTP_PROXY=${http_proxy}" "NO_PROXY=${no_proxy}"
EOF
sudo systemctl daemon-reload
sudo systemctl restart containerd.service

参考

3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?