Linux 设置代理上网

用户级别配置

设置前

$ wget

不通

设置

$ sudo vi .bashrc

#add proxy export http_proxy=:password@yourproxy:8080/ export https_proxy=$http_proxy export ftp_proxy=$http_proxy

$ source .bashrc

设置后

$ wget

>>> --2020-03-12 15:19:48--/ Connecting to 10.224.64.61:808... connected. Proxy request sent, awaiting response... 200 OK Length: 2443 (2.4K) [text/html] Saving to: “index.html” ... ...

yum改国内源 & 设置yum代理

查看系统版本

$ cat /etc/system-release

下载对应yum源配置文件

$ wget http://mirrors.aliyun.com/repo/Centos-6.repo/

$ sudo mv Centos-6.repo /etc/yum.repos.d/CentOS-Base.repo

设置yum代理

$ sudo vi /etc/yum.conf

#add proxy proxy = :password@yourproxy:8080/ proxy = :password@yourproxy:8080/ proxy = ftp://username:password@yourproxy:8080/

$ sudo yum update

>>> ... ... * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com base | 3.7 kB 00:00 ... ...