天天看点

CentOS7 Local yum的一次报错信息

说明:今天在火车上测试一个CentOS7下的一个服务,要用到yum配置,但是本机没有联网,所以考虑到配置本地yum,按照之前CentOS6下的常规方法,居然发现有报错。

操作如下:

1)虚拟机下将CentOS7光盘加载到系统里面,然后挂载到本地的/localyum上

<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软件

[root@localhost yum.repos.d]# yum -y install vsftpd

<code>已加载插件:fastestmirror, langpacksCould not retrieve mirrorlist http:</code><code>//mirrorlist</code><code>.centos.org/?release=7&amp;arch=x86_64&amp;repo=os&amp;infra=stock error was14: curl</code><code>#6 - "Could not resolve host: mirrorlist.centos.org; 未知的错误" One of the configured repositories failed (未知), and yum doesn't have enough cached data to continue. At this point the only safe thing yum can do is fail. There are a few ways to work "fix" 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        upstream. This is most often useful </code><code>if</code> <code>you are using a newer        distribution release than is supported by the repository (and the        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>just ignore the repository </code><code>until</code> <code>you permanently </code><code>enable</code> <code>it again or use        --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.        Note that yum will try to contact the repo. when it runs most commands,        so will have to try and fail each </code><code>time</code> <code>(and thus. yum will be be much        slower). If it is a very temporary problem though, this is often a </code><code>nice</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>yum --disablerepo=\* --enablerepo=localyum clean all </code><code>#清除缓存</code>

<code>yum --disablerepo=\* --enablerepo=localyum makecache </code><code>#缓存本地yum源包信息</code>

5)重新安装下vsftpd软件

<code>已加载插件:fastestmirror, langpacksbase                                                                                                                         | 3.6 kB  00:00:00     extras                                                                                                                       | 3.4 kB  00:00:00     localyum                                                                                                                     | 3.6 kB  00:00:00     updates                                                                                                                      | 3.4 kB  00:00:00     (1</code><code>/6</code><code>): localyum</code><code>/group_gz</code>                                                                                                    <code>| 154 kB  00:00:00     (2</code><code>/6</code><code>): localyum</code><code>/primary_db</code>                                                                                                   <code>| 2.7 MB  00:00:00     (3</code><code>/6</code><code>): extras</code><code>/7/x86_64/primary_db</code>                                                                                            <code>| 149 kB  00:00:00     (4</code><code>/6</code><code>): updates</code><code>/7/x86_64/primary_db</code>                                                                                           <code>| 5.7 MB  00:00:18     (5</code><code>/6</code><code>): base</code><code>/7/x86_64/group_gz</code>                                                                                                <code>| 155 kB  00:00:21     (6</code><code>/6</code><code>): base</code><code>/7/x86_64/primary_db</code>                                                                                              <code>| 5.3 MB  00:00:29     Determining fastest mirrors * base: mirrors.163.com * extras: mirrors.cqu.edu.cn * updates: mirrors.cqu.edu.cn正在解决依赖关系--&gt; 正在检查事务---&gt; 软件包 vsftpd.x86_64.0.3.0.2-11.el7_2 将被 安装--&gt; 解决依赖关系完成</code>

<code>依赖关系解决</code>

<code>==================================================================================================================================================== Package                          架构                             版本                                     源                                 大小====================================================================================================================================================正在安装: vsftpd                           x86_64                           3.0.2-11.el7_2                           updates                           167 k</code>

<code>事务概要====================================================================================================================================================安装  1 软件包</code>

<code>总下载量:167 k安装大小:347 kDownloading packages:vsftpd-3.0.2-11.el7_2.x86_64.rpm                                                                                             | 167 kB  00:00:00     Running transaction checkRunning transaction testTransaction </code><code>test</code> <code>succeededRunning transaction  正在安装    : vsftpd-3.0.2-11.el7_2.x86_64                                                                                                    1</code><code>/1</code>   <code>验证中      : vsftpd-3.0.2-11.el7_2.x86_64                                                                                                    1</code><code>/1</code>

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

<code>完毕!</code>

6)配置光盘开机自动挂载

<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>

本文转自 冰冻vs西瓜 51CTO博客,原文链接:http://blog.51cto.com/molewan/1826902,如需转载请自行联系原作者

继续阅读