因爲一個機房的網絡限制,沒法訪問國外IP地址,在安裝一些開源軟件的時候好比smokeping、ansible就沒法從epel源在線安裝,nginx
編譯安裝的話,又須要安裝各類依賴,麻煩的一逼。因此就想各類方法,完成在線安裝吧,又不是不能上網。網絡
一、用阿里雲的epel源阿里雲
受制於見識有限,之前只知道阿里雲有Base.Repo。今天在阿里雲ECS yum裝Nginx,就用yum repolist查看了ECS自帶的倉庫,url
發現其中有epel源,並由10000多個軟件,以下所示:spa
Loaded plugins: security repo id repo name status base CentOS-6 - Base 6,696 epel Extra Packages for Enterprise Linux 6 - x86_64 12,200 extras CentOS-6 - Extras 62 updates CentOS-6 - Updates 706 repolist: 19,664
阿里雲EPEL地址:http://mirrors.aliyun.com/epel/ 具體epel.repo文件見文章末尾。.net
二、用YUM代理訪問(有一些報錯,暫時還未解決)debug
A 機器192.168.100.1 能夠訪問國外IP代理
B 機器192.168.100.2 不能訪問國外IPcode
1)A機器上用Nginx開代理服務 server
在nginx配置目錄下新增 yum_proxy.conf
server { resolver 8.8.8.8; listen 10010; location / { proxy_pass http://$http_host$request_uri; access_log off; } }
並從新加載nginx -s reload
2)在B機器上配置yum代理
在/etc/yum.conf中新增一行
proxy=http://192.168.100.1:10010
3)執行yum 安裝操做
有報錯,待解決,待續
3、附錄:
一、阿里雲epel.repo
[epel] name=Extra Packages for Enterprise Linux 6 - $basearch baseurl=http://mirrors.aliyun.com/epel/6/$basearch http://mirrors.aliyuncs.com/epel/6/$basearch failovermethod=priority enabled=1 gpgcheck=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 [epel-debuginfo] name=Extra Packages for Enterprise Linux 6 - $basearch - Debug baseurl=http://mirrors.aliyun.com/epel/6/$basearch/debug http://mirrors.aliyuncs.com/epel/6/$basearch/debug failovermethod=priority enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 gpgcheck=0 [epel-source] name=Extra Packages for Enterprise Linux 6 - $basearch - Source baseurl=http://mirrors.aliyun.com/epel/6/SRPMS http://mirrors.aliyuncs.com/epel/6/SRPMS failovermethod=priority enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 gpgcheck=0
二、YUM代理設置參考 :http://blog.csdn.net/fwj380891124/article/details/39642877