天天看點

CentOS7 Local yum的一次報錯資訊

說明:今天在火車上測試一個CentOS7下的一個服務,要用到yum配置,但是本機沒有聯網,是以考慮到配置本地yum,按照之前CentOS6下的正常方法,居然發現有報錯。

操作如下:

1)虛拟機下将CentOS7CD光牒加載到系統裡面,然後挂載到本地的/localyum上

<code>[root@localhost yum.repos.d]</code><code># mkdir -p /localyum</code>

<code>[root@localhost yum.repos.d]</code><code># mount /dev/cdrom /localyum</code>

2)添加一個repo檔案

<code>[root@localhost ~]</code><code># cd /etc/yum.repos.d/</code>

<code>[root@localhost yum.repos.d]</code><code># vim CentOS7-local.repo </code>

<code>[localyum]</code>

<code>name=localyum</code>

<code>baseurl=</code><code>file</code><code>:</code><code>///localyum/</code>

<code>gpgcheck=0</code>

<code>enabled=1</code>

3)測試安裝下vsftpd軟體

<code>[root@localhost yum.repos.d]</code><code># yum -y install vsftpd</code>

<code>已加載插件:fastestmirror, langpacks</code>

<code>Could not retrieve mirrorlist http:</code><code>//mirrorlist</code><code>.centos.org/?release=7&amp;arch=x86_64&amp;repo=os&amp;infra=stock error was</code>

<code>14: curl</code><code>#6 - "Could not resolve host: mirrorlist.centos.org; 未知的錯誤"</code>

<code> </code><code>One of the configured repositories failed (未知),</code>

<code> </code><code>and yum doesn't have enough cached data to </code><code>continue</code><code>. At this point the only</code>

<code> </code><code>safe thing yum can </code><code>do</code> <code>is fail. There are a few ways to work </code><code>"fix"</code> <code>this:</code>

<code>     </code><code>1. Contact the upstream </code><code>for</code> <code>the repository and get them to fix the problem.</code>

<code>     </code><code>2. Reconfigure the baseurl</code><code>/etc</code><code>. </code><code>for</code> <code>the repository, to point to a working</code>

<code>        </code><code>upstream. This is most often useful </code><code>if</code> <code>you are using a newer</code>

<code>        </code><code>distribution release than is supported by the repository (and the</code>

<code>        </code><code>packages </code><code>for</code> <code>the previous distribution release still work).</code>

<code>     </code><code>3. Disable the repository, so yum won't use it by default. Yum will </code><code>then</code>

<code>        </code><code>just ignore the repository </code><code>until</code> <code>you permanently </code><code>enable</code> <code>it again or use</code>

<code>        </code><code>--enablerepo </code><code>for</code> <code>temporary usage:</code>

<code>            </code><code>yum-config-manager --disable &lt;repoid&gt;</code>

<code>     </code><code>4. Configure the failing repository to be skipped, </code><code>if</code> <code>it is unavailable.</code>

<code>        </code><code>Note that yum will try to contact the repo. when it runs most commands,</code>

<code>        </code><code>so will have to try and fail each </code><code>time</code> <code>(and thus. yum will be be much</code>

<code>        </code><code>slower). If it is a very temporary problem though, this is often a </code><code>nice</code>

<code>        </code><code>compromise:</code>

<code>            </code><code>yum-config-manager --save --setopt=&lt;repoid&gt;.skip_if_unavailable=</code><code>true</code>

<code>Cannot </code><code>find</code> <code>a valid baseurl </code><code>for</code> <code>repo: base</code><code>/7/x86_64</code>

4)由于是在區域網路内,無法正常連上外網,所有重新調整了下repo檔案

<code>[root@localhost yum.repos.d]</code><code># yum --disablerepo=\* --enablerepo=localyum clean all#清除緩存</code>

<code>[root@localhost yum.repos.d]</code><code># yum --disablerepo=\* --enablerepo=localyum makecache#快取區域yum源包資訊</code>

5)重新安裝下vsftpd軟體

<code>base                                                                                                                         | 3.6 kB  00:00:00     </code>

<code>extras                                                                                                                       | 3.4 kB  00:00:00     </code>

<code>localyum                                                                                                                     | 3.6 kB  00:00:00     </code>

<code>updates                                                                                                                      | 3.4 kB  00:00:00     </code>

<code>(1</code><code>/6</code><code>): localyum</code><code>/group_gz</code>                                                                                                     <code>| 154 kB  00:00:00     </code>

<code>(2</code><code>/6</code><code>): localyum</code><code>/primary_db</code>                                                                                                   <code>| 2.7 MB  00:00:00     </code>

<code>(3</code><code>/6</code><code>): extras</code><code>/7/x86_64/primary_db</code>                                                                                            <code>| 149 kB  00:00:00     </code>

<code>(4</code><code>/6</code><code>): updates</code><code>/7/x86_64/primary_db</code>                                                                                           <code>| 5.7 MB  00:00:18     </code>

<code>(5</code><code>/6</code><code>): base</code><code>/7/x86_64/group_gz</code>                                                                                                <code>| 155 kB  00:00:21     </code>

<code>(6</code><code>/6</code><code>): base</code><code>/7/x86_64/primary_db</code>                                                                                              <code>| 5.3 MB  00:00:29     </code>

<code>Determining fastest mirrors</code>

<code> </code><code>* base: mirrors.163.com</code>

<code> </code><code>* extras: mirrors.cqu.edu.cn</code>

<code> </code><code>* updates: mirrors.cqu.edu.cn</code>

<code>正在解決依賴關系</code>

<code>--&gt; 正在檢查事務</code>

<code>---&gt; 軟體包 vsftpd.x86_64.0.3.0.2-11.el7_2 将被 安裝</code>

<code>--&gt; 解決依賴關系完成</code>

<code>依賴關系解決</code>

<code>====================================================================================================================================================</code>

<code> </code><code>Package                          架構                             版本                                     源                                 大小</code>

<code>正在安裝:</code>

<code> </code><code>vsftpd                           x86_64                           3.0.2-11.el7_2                           updates                           167 k</code>

<code>事務概要</code>

<code>安裝  1 軟體包</code>

<code>總下載下傳量:167 k</code>

<code>安裝大小:347 k</code>

<code>Downloading packages:</code>

<code>vsftpd-3.0.2-11.el7_2.x86_64.rpm                                                                                             | 167 kB  00:00:00     </code>

<code>Running transaction check</code>

<code>Running transaction </code><code>test</code>

<code>Transaction </code><code>test</code> <code>succeeded</code>

<code>Running transaction</code>

<code>  </code><code>正在安裝    : vsftpd-3.0.2-11.el7_2.x86_64                                                                                                    1</code><code>/1</code> 

<code>  </code><code>驗證中      : vsftpd-3.0.2-11.el7_2.x86_64                                                                                                    1</code><code>/1</code> 

<code>已安裝:</code>

<code>  </code><code>vsftpd.x86_64 0:3.0.2-11.el7_2                                                                                                                    </code>

<code>完畢!</code>

6)配置CD光牒開機自動挂載

<code>[root@localhost ~]</code><code># echo "/dev/cdrom /localyum iso9660 defaults  0 0"&gt;&gt;/etc/fstab</code>

<code>[root@localhost ~]</code><code># mount -a</code>

<code>再次運作,yum -y </code><code>install</code> <code>vsftpd,就沒有類似的報錯了</code>

本文轉自 冰凍vs西瓜 51CTO部落格,原文連結:http://blog.51cto.com/molewan/1892406,如需轉載請自行聯系原作者

繼續閱讀