DockerのホストOSとしてubuntuを採用することにしましたが、ubuntuには初めて触る初心者なので、早速プロキシの設定でつまづいたので調べてやってみました。
cat /etc/os-release
NAME=”Ubuntu”
VERSION=”20.04.4 LTS (Focal Fossa)”
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME=”Ubuntu 20.04.4 LTS”
VERSION_ID=”20.04″
HOME_URL=”https://www.ubuntu.com/”
SUPPORT_URL=”https://help.ubuntu.com/”
BUG_REPORT_URL=”https://bugs.launchpad.net/ubuntu/”
PRIVACY_POLICY_URL=”https://www.ubuntu.com/legal/terms-and-policies/privacy-policy”
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION=”Ubuntu 20.04.4 LTS”
uname -a
Linux [ホスト名] 5.11.0-27-generic #29~20.04.1-Ubuntu SMP Wed Aug 11 15:58:17 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
ubuntuのバージョンは『20.04.4 LTS』です。ーバー機に直接インストールしています。
設定ファイルを新規作成で開きます。
sudo vi /etc/apt/apt.conf.d/01proxy
プロキシ情報を記述。
cquire::http::Proxy "http://[IPアドレス]:[ポート]";
ユーザが利用するシェルを確認します。
env | grep sh
SHELL=/bin/bash
.bashrcの末尾に、設定を追記していきます。
vi ~/.bashrc
.bashrcの末尾に、設定を追記していきます。
# PROXY config export https_proxy="http://xxx.xxx.xxx.xxx:8080" export http_proxy="http://xxx.xxx.xxx.xxx:8080" export ftp_proxy="http://xxx.xxx.xxx.xxx:8080"
追記した設定を読み込ませます。
source ~/.bashrc
設定が反映されているか確認します。
env | grep proxy
ftp_proxy=http://xxx.xxx.xxx.xxx:8080
https_proxy=http://xxx.xxx.xxx.xxx:8080
http_proxy=http://xxx.xxx.xxx.xxx:8080