1
2

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 5 years have passed since last update.

proxy配下のLinuxであれやこれや動作させるには

Last updated at Posted at 2019-02-21

LinuxサーバがProxy環境下にある場合の各種設定メモ。
本当はProxy配下なんかで作業したくないけど!

OS全体に設定する

下記のファイルを新規作成する

/etc/profile.d/proxy.sh
PROXY='<proxy name or ip>[:port]'
export http_proxy=$PROXY
export HTTP_PROXY=$PROXY
export https_proxy=$PROXY
export HTTPS_PROXY=$PROXY

次回ログインすると設定が有効化される。
もしくは、下記で反映する。

# source /etc/profile

yum

/etc/yum.conf
[main]

proxy=http://<proxyname_or_ip>[:port]

pip

# pip install hogehoge --proxy=<proxyname_or_ip>[:port]

Git

以下の通りファイルを作成、もしくは追記する。

~/.gitconfig
[http]
        proxy = http://<proxyname_or_ip>[:port]
[https]
        proxy = http://<proxyname_or_ip>[:port]

または下記コマンド実行でも.gitconfigに反映される

# git config --global http.proxy http://<proxyname_or_ip>[:port]
# git config --global https.proxy http://<proxyname_or_ip>[:port]

Docker

以下を追記。

/etc/systemd/system/docker.service
[Service]
Environment="HTTP_PROXY=http://<proxyname_or_ip>[:port]"
1
2
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
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?