Linux Centos7 配置代理

前言:

[ ~]# cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
众所周知,由于某些原因,国内访问很多外网速度奇慢,导致我们在安装软件的时候很慢很慢,这个时候,我们可以使用代理来解决这个问题:
注意:优先使用国内yum源!参考链接:
好了,来说说配置代理的事情:

一.系统全局的代理设置;
用vi/vim编辑器打开/etc/profile,追加如下内容:

http_proxy=http://192.168.1.100:1080
ftp_proxy=http://192.168.1.100:1080
export http_proxy
export ftp_proxy
如果需要输入账号和密码,则追加的内容如下:

http_proxy=http://username::1080
ftp_proxy=http://username::1080
export http_proxy
export ftp_proxy
另外,如果不想做全局配置,只为某一用户配置,例如root,则可以将上述内容之一配置追加到/root/.bash_profile

二.yum的代理设置;
用vi/vim编辑器打开/etc/yum.conf,追加如下内容:

http_proxy=http://192.168.1.100:1080
ftp_proxy=http://192.168.1.100:1080
1
2
或者:
1
http_proxy=http://192.168.1.100:1080
ftp_proxy=http://192.168.1.100:1080
proxy_username=username
proxy_password=password
1
2
3
4
另外,ubuntu的OS apt-get代理联网设置可以用如下方法:

echo ‘Acquire::http::proxy “http://192.168.1.100:1080;’ >> /etc/apt/apt.conf

三.wget的代理设置;
用vi/vim编辑器打开/etc/wgetrc,找到代理设置所在行,然后追加如下内容:

# You can set the default proxies for Wget to use for http, https, and ftp.
# They will override the value in the environment.
#https_proxy = http://proxy.yoyodyne.com:18023/
#http_proxy = http://proxy.yoyodyne.com:18023/
#ftp_proxy = http://proxy.yoyodyne.com:18023/
http_proxy=http://192.168.1.100:1080/
ftp_proxy=http://192.168.1.100:1080/

四、设置firefox上网代理:
设置路径,Edit–> Preferences–>Advanced–>Network–>Settings.

测试一下:


速度杠杠的!
————————————————
版权声明:本文为CSDN博主「SHUIPING_YANG」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/zhezhebie/article/details/75386382

相关推荐