Linux Centos7 配置代理


前言:

[root@minimal ~]# 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:passwd@192.168.1.100:1080
ftp_proxy=http://username:passwd@192.168.1.100:1080
export http_proxy
export ftp_proxy
另外,如果不想做全局配置,只為某一用戶配置,例如root,則可以將上述內容之一配置追加到/root/.bash_profile

修改完成執行 . /etc/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/

use_proxy = on
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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM