Linux ライクなオペレーティング システムでは、http_proxy、ftp_proxy、https_proxy などの変数を使用して、Linux コンソールのプロキシ経由でインターネットにアクセスできます。
上記の変数はすべて、elinks、wget、lynx、rsync などのツールで使用できます。
プロキシ サーバーの背後にあり、プロキシ設定を介してのみインターネット接続を取得できる Linux サーバーを想定しています。
コマンド ラインでのプロキシ設定
例 1 :プロキシ経由で http ベース サイトにアクセスし、以下の変数を使用します。
構文:
# export http_proxy=http://[proxy-server-ip-or-dns-name]:[Port-Number]
例:
# export http_proxy=http://proxy.thegeekdiary.com:8080
例 2 :パスワード保護プロキシ設定。
構文:
# export http_proxy=http://USERNAME:PASSWORD@[proxy-server-ip-or-dns-name]:PORT
例:
# export http_proxy=http://nsit:*****@proxy.thegeekdiary.com:8080/
上記のコマンドを使用して、ユーザー名とパスワードとともにプロキシ設定を設定しました。
例 3 :セキュア サイト (https) にプロキシ経由でアクセスするには、以下の変数を設定します。
構文:
# export https_proxy=http://[proxy-server-ip-or-dns-name]:[Port-Number]
例:
# export https_proxy=http://proxy.thegeekdiary.com:8080/
例 4 :プロキシ経由で ftp ベースのサイトにアクセスするには、以下の変数を設定します:
構文:
# export ftp_proxy=http://[proxy-server-ip-or-dns-name]:[Port-Number]
例:
# export ftp_proxy=http://proxy.thegeekdiary.com:8080/
注意 :これらの変数は特定のセッションに対して宣言されているため、永続的に設定するには、ファイルでこれらの変数を定義します:
# vi /etc/bash.bashrc export http_proxy=http://proxy.thegeekdiary.com:8080/ export ftp_proxy=http://proxy.thegeekdiary.com:8080/ https_proxy=http://proxy.thegeekdiary.com:8080/
例 5 :Ubuntu Linux の APT でのプロキシ設定。
# vi /etc/apt/apt.conf Acquire::http::Proxy "http://[proxy-server-ip-or-dns-name]:[Port-Number]";
例 6 :RSYNC のプロキシ設定:
構文:
# export RSYNC_PROXY="http://[proxy-server-ip-or-dns-name]:[Port-Number]”
例:
# export RSYNC_PROXY="http://proxy.thegeekdiary.com:8080”