Help us understand the problem. What is going on with this article?

Raspbianプロキシ設定まとめ

More than 1 year has passed since last update.

Raspbian Busterでプロキシをもろもろ設定したのでまとめます。

apt-get

export http_proxy="http://USERNAME:PASSWORD@IP:PORT/"
export https_proxy="http://USERNAME:PASSWORD@IP:PORT/"
export ftp_proxy="http://USERNAME:PASSWORD@IP:PORT/"

時刻

プロキシ経由だとntpが効かない。
次のコマンドの後rebootで時刻を合わせる。

date --set @"$(wget -q https://ntp-a1.nict.go.jp/cgi-bin/jst -O - | sed -n 4p | cut -d. -f1)"

chromium

オプションをつけて起動かプラグインを入れるか。
プラグインを入れると通常起動でプロキシが使える。
下記コマンドでchromiumを起動して、Chromeウェブストアからプラグイン「Proxy SwitchyOmega」を追加する。

chromium-browser --proxy-server=https=IP:PORT

追加できたら次のように設定し「Apply change」を押す。
※時刻が合ってないとプラグインの追加ができないっぽい
image.png

wget

/etc/wgetrcYou can set the default proxies...のところに追記

/etc/wgetrc
http_proxy="http://USERNAME:PASSWORD@IP:PORT/"
https_proxy="http://USERNAME:PASSWORD@IP:PORT/"
ftp_proxy="http://USERNAME:PASSWORD@IP:PORT/"

git

git config --global http.proxy http://IP:PORT
git config --global https.proxy http://IP:PORT

python

pythonのリクエストモジュールは大文字の指定しか読み込まないらしい。

export HTTP_PROXY="http://USERNAME:PASSWORD@IP:PORT/"
export HTTPS_PROXY="http://USERNAME:PASSWORD@IP:PORT/"
export FTP_PROXY="http://USERNAME:PASSWORD@IP:PORT/"

pip instal

pipはオプションにつけるしかない

pip install もじゅーる --proxy="http://USERNAME:PASSWORD@IP:PORT/"

SSL認証系のエラーが置きたら以下のオプションを追加するといい

 --trusted-host pypi.org --trusted-host www.piwheels.org

curl

-x で指定

curl ~~ -x http://IP:PORT

Docker

daemon

sudo mkdir -p /etc/systemd/system/docker.service.d
echo -e "[Service]\nEnvironment=\"HTTP_PROXY=http://IP:PORT\"" | sudo tee /etc/systemd/system/docker.service.d/http-proxy.conf
sudo systemctl daemon-reload
sudo systemctl restart docker

container

mkdir ~/.docker
nano ~/.docker/config.json
{
    "proxies":
    {
        "default":
        {
            "httpProxy": "http://IP:PORT"
        }
    }
}

npm

sudo npm -g config set proxy "http://USERNAME:PASSWORD@IP:PORT/"
sudo npm -g config set https-proxy "http://USERNAME:PASSWORD@IP:PORT/"
sudo npm -g config set registry "http://registry.npmjs.org/"
koyayashi
Sierのしがないエンジニア 仕事ではcppやQt、プライベートではNode.jsを勉強中
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした