最近在安裝環境時遇到yum
安裝時,當鏡像使用某些domain
因被擋,而造成timeout
以至於安裝失敗,需要proxy來繞過。
只在此session
生效
$ export http_proxy=http://<host>:<port>
$ export https_proxy=https://<host>:<port>
適用於特定使用者
$ echo "export http_proxy=http://<host>:<port>" >> ~/.bashrc
$ echo "export https_proxy=https://<host>:<port>" >> ~/.bashrc
適用於全部的使用者
$ echo "export http_proxy=http://<host>:<port>" >> /etc/profile
$ echo "export https_proxy=https://<host>:<port>" >> /etc/profile
適用於yum
$ vim /etc/yum.conf
proxy=http://<host>:<port>
當proxy需要使用者認證時則在<host>前加上使用者資訊
http://<user>:<password>@<host>:<port>