事件:由于我们在运维过程中需要升级或安装新的开源软件或组件时,相关的依赖包或基础包非常非常多。
因安全限制,对于没有访问internet权限的服务器,在执行安装或升级过程中就非常容易出错。
所以我们需要考虑用代理服务器,使不能上internet的服务器,通过代理下载相关软件或升级包。
部署:能上internet的服务器做为代理服务器,不能上网的做为客户端或叫被代理服务器
实战:(IPP3)123.103.7.XXX(代理服务器) 172.168.173.9(被代理服务器) 测试结果:成功的
代理服务器配置:123.103.7.XXX(IPP3)
+++++++++++++++++++++++++++++++++++++++
1.安装 yum -y install squid
2.配置 vi /etc/squid/squid.cnf
---------------------------------------------------------
dns_nameservers 8.8.8.8
dns_nameservers 114.114.114.114
http_access allow all
http_port 3128
cache_mem 600 MB
visible_hostname yum.com
3.启动和关闭
---------------------------------------------------------
service
squid start
service
squid stop
service
squid restart
4.测试
---------------------------------------------------------
squidclient
mgr:info (测试配置信息)
squidclient
http://www.baidu.com
(测试是否成功)
---------------------------------------------------------
客户端(被代理)配置: 172.168.173.9
+++++++++++++++++++++++++++++++++++++++
1.yum 配置 vi /etc/yum.conf
------------------------------------------
proxy=http://172.168.173.2:3128
------------------------------------------
2.wget
配置
vi /etc/wgetrc
------------------------------------------
http_proxy
= http://172.168.173.2:3128/
use_proxy
= on
------------------------------------------
注意:从安全风险考虑,用完之后请关闭服务 service squid stop,谢谢
附常见的几个yum仓库:
软件包地址:http://download1.rpmfusion.org/free/el/updates/6/i386/rpmfusion-free-release-6-1.noarch.rpm
软件包地址:http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
软件包地址: http://dev.mysql.com/get/mysql57-community-release-el6-7.noarch.rpm
软件包地址: http://yum.centreon.com/standard/2.2/ces-standard.repo
软件包地址: http://apt.sw.be/redhat/el6/en/i386/rpmforge/RPMS/rpmforge-release-0.5.2-2.el6.rf.i686.rpm