#-#######,###[base]nameCentOS-5-Base-163.combaseurlhttp://mirrors.163.com/centos/5/os/$basearch/#mirrorlisthttp://mirrorlist.centos.org/?release5arch$basearchrepoosgpgcheck1gpgkeyhttp://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5#releasedupdates[updates]nameCentOS-5-Updates-163.combaseurlhttp://mirrors.163.com/centos/5/updates/$basearch/#mirrorlisthttp://mirrorlist.centos.org/?release5arch$basearchrepoupdatesgpgcheck1gpgkeyhttp://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5#packagesused/producedinthebuildbutnotreleased[addons]nameCentOS-5-Addons-163.combaseurlhttp://mirrors.163.com/centos/5/addons/$basearch/#mirrorlisthttp://mirrorlist.centos.org/?release5arch$basearchrepoaddonsgpgcheck1gpgkeyhttp://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5#additionalpackagesthatmaybeuseful[extras]nameCentOS-5-Extras-163.combaseurlhttp://mirrors.163.com/centos/5/extras/$basearch/#mirrorlisthttp://mirrorlist.centos.org/?release5arch$basearchrepoextrasgpgcheck1gpgkeyhttp://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5#additionalpackagesthatextendfunctionalityofexistingpackages[centosplus]nameCentOS-5-Plus-163.combaseurlhttp://mirrors.163.com/centos/5/centosplus/$basearch/#mirrorlisthttp://mirrorlist.centos.org/?release5arch$basearchrepocentosplusgpgcheck1enabled0gpgkeyhttp://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5#contrib-packagesbyCentosUsers[contrib]nameCentOS-5-Contrib-163.combaseurlhttp://mirrors.163.com/centos/5/contrib/$basearch/#mirrorlisthttp://mirrorlist.centos.org/?release5arch$basearchrepocontribgpgcheck1enabled0gpgkeyhttp://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5 yumcleanall 清除原有缓存
yumlist 获取yum列表
如果出现列表数据如下这种表示设置成功
sqlite-devel.i3863.3.6-7basesqlite-devel.x86_643.3.6-7basesquashfs-tools.x86_643.0-4basesquirrelmail.noarch1.4.8-21.el5.centosbasesrptools.x86_640.0.4-10.el5basesssd.x86_641.5.1-70.el5basesssd-client.i3861.5.1-70.el5basesssd-client.x86_641.5.1-70.el5basesssd-tools.x86_641.5.1-70.el5base
2、安装squid
squid介绍及其简单配置
前面准备好yum命令可以直接在线安装
yuminstallsquid 安装完成后cd /etc/squid/目下修改squid.conf文件中的内容修改之前可以先备份该文件
cpsquid.confsquid.conf_bak 然后找到文件中的http_accessdenyall 将其修改为http_accessallowall 表示所有用户都可以访问这个代理
还有找到 http_port3128 修改为 http_port192.168.3.171:3128 这里的IP及端口是squid的代理IP及端口
该IP是能访问外网机器的IP地址如果是本机则可以不用修改该地址下面启动squid代理
[rootlocalhostsquid]#squid-kparse[rootlocalhostsquid]#[rootlocalhostsquid]#[rootlocalhostsquid]#squid-z2014/07/2214:43:01|CreatingSwapDirectories[rootlocalhostsquid]#[rootlocalhostsquid]#[rootlocalhostsquid]#servicesquidstartStartingsquid:[OK][rootlocalhostsquid]#[rootlocalhostsquid]#[rootlocalhostsquid]#[rootlocalhostsquid]#netstat-nltpActiveInternetconnections(onlyservers)ProtoRecv-QSend-QLocalAddressForeignAddressStatePID/Programnametcp000.0.0.0:1110.0.0.0:*LISTEN4341/portmaptcp000.0.0.0:31280.0.0.0:*LISTEN22862/(squid)tcp000.0.0.0:7920.0.0.0:*LISTEN4426/rpc.statd
3、配置不能访问外网的机器代理
在其他有需要访问外网的内网机器上设置其访问外部网络的代理机器
exporthttp_proxyhttp://192.168.3.171:3128
export的效力仅及于该此登陆操作非全局详细内容可参考linux环境变量export命令详解
这样就可以让不能访问外部网络的内网机器通过可以访问外网的机器做为代理访问到外部网络来方便安装一些软件命令等操作。