红联Linux门户
Linux帮助

如何安装yum数据库文件和信息索引文件?

发布时间:2010-08-25 17:54:44来源:红联作者:昊昊荡荡
[i=s] 本帖最后由 昊昊荡荡 于 2010-8-25 18:09 编辑 [/i]

我把fedora 13DVD光盘镜像挂载到/mnt/cdrom下面,并把Packages目录拷贝到/home/wuhaoshu/packages下。
在/etc/yum.repo.d/下创建名为cdrom.repo的文件。

[root@fedora13 home]# cat /etc/yum.repos.d/cdrom.repo
#cdrom.repo:
[cdrom]
name = cdrom
baseurl = file:///home/packages
enabled = 1
gpgcheck = 1
gpgkey = file:///home/RPM-GPG-KEY-fedora-i386


关键是利用createrepo命令创建yum数据库文件和信息索引文件这一步我不太明白,到底是用光盘中的repodata目录下的repomd.xml与/home/packages生成yum数据库文件和信息索引文件吗,如下
createrepo -g /mnt/cdrom/repodata/repomd.xml /home/packages

还是把/mnt/cdrom/repodata/repomd.xml 文件拷贝到/home目录下再执行 createrepo -g命令。
总之两种方法都没能成功。我在家里的fedora 13虚拟机中实验成功了的。但单位上是fedora 13主机,反而还没有成功。

[root@fedora13 ~]# yum clean all
Loaded plugins: axelget, fastestmirror, presto, refresh-packagekit
Repository fedora is listed more than once in the configuration
Repository fedora-debuginfo is listed more than once in the configuration
Repository fedora-source is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository updates-debuginfo is listed more than once in the configuration
Repository updates-source is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository updates-debuginfo is listed more than once in the configuration
Repository updates-source is listed more than once in the configuration
Repository fedora is listed more than once in the configuration
Repository fedora-debuginfo is listed more than once in the configuration
Repository fedora-source is listed more than once in the configuration
Cleaning repos: cdrom fedora livna rpmfusion-free rpmfusion-free-updates
: rpmfusion-nonfree rpmfusion-nonfree-updates updates
Cleaning up Everything
Cleaning up list of fastest mirrors
0 delta-package files removed, by presto
[root@fedora13 ~]# yum makecache
Loaded plugins: axelget, fastestmirror, presto, refresh-packagekit
Repository fedora is listed more than once in the configuration
Repository fedora-debuginfo is listed more than once in the configuration
Repository fedora-source is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository updates-debuginfo is listed more than once in the configuration
Repository updates-source is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository updates-debuginfo is listed more than once in the configuration
Repository updates-source is listed more than once in the configuration
Repository fedora is listed more than once in the configuration
Repository fedora-debuginfo is listed more than once in the configuration
Repository fedora-source is listed more than once in the configuration
fedora/metalink | 12 kB 00:00
repomd.xml | 4.3 kB 00:00
Initializing download: http://mirrors.sohu.com/fedora/releases/13/Everything/i386/os/repodata/8a20d747882b41aeef1bac93f1925b304a9147e094c5c334f492ac0db6cfbafd-prestodelta.xml.gz
File size: 414 bytes
Opening output file /var/cache/yum/i386/13/fedora/8a20d747882b41aeef1bac93f1925b304a9147e094c5c334f492ac0db6cfbafd-prestodelta.xml.gz
Starting download

Connection 0 finished
Connection 2 finished ]
Connection 3 finished
Connection 4 finished
[100%] [..................................................] [ 2.0KB/s] [00:00]

Downloaded 414 bytes in 0 seconds. (2.02 KB/s)
update fedora metadata sucessfully
repomd.xml 44% [======- repomd.xml | 3.2 kB 00:02
update livna metadata sucessfully
repomd.xml | 2.8 kB 00:00
update rpmfusion-free metadata sucessfully
repomd.xml | 2.8 kB 00:00
update rpmfusion-free-updates metadata sucessfully
repomd.xml | 2.8 kB 00:00
update rpmfusion-nonfree metadata sucessfully
repomd.xml | 2.8 kB 00:00
update rpmfusion-nonfree-updates metadata sucessfully
updates/metalink | 9.5 kB 00:00
repomd.xml | 4.5 kB 00:00
Initializing download: http://mirrors.sohu.com/fedora/updates/13/i386/repodata/f224bdd3f5e3f4b4ee42f3566d94bd8ca64a70dea2667d573aa1d74c96ae0eb4-prestodelta.xml.gz
HTTP/1.1 404 Not Found
update updates metadata sucessfully
Finish Download MetaData of Enabled Repo
Determining fastest mirrors
* fedora: mirrors.sohu.com
* livna: ftp-stud.fht-esslingen.de
* rpmfusion-free: mirrors.163.com
* rpmfusion-free-updates: mirrors.163.com
* rpmfusion-nonfree: mirrors.163.com
* rpmfusion-nonfree-updates: mirrors.163.com
* updates: mirrors.sohu.com
cdrom | 1.9 kB 00:00 ...
cdrom/filelists | 2.3 MB 00:00 ...
cdrom/primary | 952 kB 00:00 ...
cdrom/other | 1.0 MB 00:00 ...
cdrom/group_gz | 735 B 00:00 ...
fedora/filelists_db | 16 MB 01:41
fedora/primary_db | 10 MB 00:28
fedora/other_db | 5.9 MB 00:18
fedora/group_gz | 389 kB 00:01
livna | 3.2 kB 00:00
livna/filelists_db | 1.4 kB 00:00
livna/primary_db | 3.0 kB 00:00
livna/other_db | 1.1 kB 00:00
livna/group_gz | 448 B 00:00
rpmfusion-free | 2.8 kB 00:00
rpmfusion-free/group_gz | 1.5 kB 00:00
rpmfusion-free/filelists_db | 337 kB 00:00
rpmfusion-free/primary_db | 304 kB 00:00
rpmfusion-free/other_db | 100 kB 00:00
rpmfusion-free-updates | 2.8 kB 00:00
rpmfusion-free-updates/group_gz | 1.5 kB 00:00
rpmfusion-free-updates/filelists_db | 168 kB 00:00
rpmfusion-free-updates/primary_db | 287 kB 00:00
rpmfusion-free-updates/other_db | 93 kB 00:00
rpmfusion-nonfree | 2.8 kB 00:00
rpmfusion-nonfree/group_gz | 1.0 kB 00:00
rpmfusion-nonfree/filelists_db | 62 kB 00:00
rpmfusion-nonfree/primary_db | 97 kB 00:00
rpmfusion-nonfree/other_db | 40 kB 00:00
rpmfusion-nonfree-updates | 2.8 kB 00:00
rpmfusion-nonfree-updates/group_gz | 1.0 kB 00:00
rpmfusion-nonfree-updates/filelists_db | 28 kB 00:00
rpmfusion-nonfree-updates/primary_db | 59 kB 00:00
rpmfusion-nonfree-updates/other_db | 26 kB 00:00
http://mirrors.sohu.com/fedora/updates/13/i386/repodata/41aa2a16bbffc3d07505f36b1afe4101fe172a337a85c114662ffdcd1cffc103-filelists.sqlite.bz2: [Errno 14] HTTP Error 404 : http://mirrors.sohu.com/fedora/updates/13/i386/repodata/41aa2a16bbffc3d07505f36b1afe4101fe172a337a85c114662ffdcd1cffc103-filelists.sqlite.bz2
Trying other mirror.
updates/filelists_db | 6.3 MB 00:16
updates/prestodelta | 186 kB 00:00
updates/primary_db | 3.5 MB 00:11
updates/other_db | 2.0 MB 00:05
updates/group_gz | 401 kB 00:00
updates/updateinfo | 467 kB 00:01
cdrom 2451/2451
cdrom 2451/2451
cdrom 2451/2451
Metadata Cache Created
[root@fedora13 ~]#
[root@fedora13 ~]# yum install linuxqq
Loaded plugins: axelget, fastestmirror, presto, refresh-packagekit
Repository fedora is listed more than once in the configuration
Repository fedora-debuginfo is listed more than once in the configuration
Repository fedora-source is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository updates-debuginfo is listed more than once in the configuration
Repository updates-source is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository updates-debuginfo is listed more than once in the configuration
Repository updates-source is listed more than once in the configuration
Repository fedora is listed more than once in the configuration
Repository fedora-debuginfo is listed more than once in the configuration
Repository fedora-source is listed more than once in the configuration
No metadata available for cdrom
No metadata available for fedora
repomd.xml | 3.2 kB 00:00
update livna metadata sucessfully
repomd.xml | 2.8 kB 00:00
update rpmfusion-free metadata sucessfully
repomd.xml | 2.8 kB 00:00
update rpmfusion-free-updates metadata sucessfully
repomd.xml | 2.8 kB 00:00
update rpmfusion-nonfree metadata sucessfully
repomd.xml | 2.8 kB 00:00
update rpmfusion-nonfree-updates metadata sucessfully
No metadata available for updates
Finish Download MetaData of Enabled Repo
Loading mirror speeds from cached hostfile
* fedora: mirrors.sohu.com
* livna: ftp-stud.fht-esslingen.de
* rpmfusion-free: mirrors.163.com
* rpmfusion-free-updates: mirrors.163.com
* rpmfusion-nonfree: mirrors.163.com
* rpmfusion-nonfree-updates: mirrors.163.com
* updates: mirrors.sohu.com
Setting up Install Process
Package linuxqq-v1.0.2-beta1.i386 already installed and latest version
Nothing to do
[root@fedora13 ~]#


测试的方法是在腾讯官网下载linuxqq-v1.0.2-beta1.i386.rpm并复制到/home/wuhaoshu/packages,再执行 createrepo -g 命令。
执行后再执行yum install linuxqq,提示说没有找到这个包,说明配置的cdrom本地源没有起作用,请高手指点!
文章评论

共有 5 条评论

  1. 昊昊荡荡 于 2010-08-26 18:18:42发表:

    [i=s] 本帖最后由 昊昊荡荡 于 2010-8-26 18:31 编辑 [/i]

    我将/etc/yum.repo.d/下除cdrom.repo文件之外的repo文件都移出这个目录,然后yum clean all 和yum makecache。发现cdrom源是没有问题的
    [root@fedora13 yum.repos.d]# yum install linuxqq
    Loaded plugins: axelget, fastestmirror, presto, refresh-packagekit
    No metadata available for packages
    Finish Download MetaData of Enabled Repo
    Loading mirror speeds from cached hostfile
    Setting up Install Process
    Resolving Dependencies
    --> Running transaction check
    ---> Package linuxqq.i386 0:v1.0.2-beta1 set to be installed
    --> Finished Dependency Resolution

    Dependencies Resolved

    ================================================================================
    Package Arch Version Repository Size
    ================================================================================
    Installing:
    linuxqq i386 v1.0.2-beta1 packages 4.8 M

    Transaction Summary
    ================================================================================
    Install 1 Package(s)

    Total download size: 4.8 M
    Installed size: 6.1 M
    Is this ok [y/N]: n
    Exiting on user Command
    Complete!
    [root@fedora13 yum.repos.d]# vi cdrom.repo
    [root@fedora13 yum.repos.d]# yum install linuxqq
    Loaded plugins: axelget, fastestmirror, presto, refresh-packagekit
    Finish Download MetaData of Enabled Repo
    Loading mirror speeds from cached hostfile
    cdrom | 1.3 kB 00:00 ...
    Setting up Install Process
    Resolving Dependencies
    --> Running transaction check
    ---> Package linuxqq.i386 0:v1.0.2-beta1 set to be installed
    --> Finished Dependency Resolution

    Dependencies Resolved

    ================================================================================
    Package Arch Version Repository Size
    ================================================================================
    Installing:
    linuxqq i386 v1.0.2-beta1 cdrom 4.8 M

    Transaction Summary
    ================================================================================
    Install 1 Package(s)

    Total download size: 4.8 M
    Installed size: 6.1 M
    Is this ok [y/N]: n
    Exiting on user Command
    Complete!
    [root@fedora13 yum.repos.d]# yum list linuxqq
    Loaded plugins: axelget, fastestmirror, presto, refresh-packagekit
    Finish Download MetaData of Enabled Repo
    Loading mirror speeds from cached hostfile
    Available Packages
    linuxqq.i386 v1.0.2-beta1 cdrom
    [root@fedora13 yum.repos.d]#

    createrepo -g *.xml /home/packages换成 createrepo /home/packcages即可。
    我发现一个问题,如果要找的包只有cdrom中有的话,就会从yum中安装。如果找的包几个源中都有的话,一般都会从互联网的源中进行安装。顺便说一句我安装了fastestmirror这个插件的。
    我想请教的问题是,本地源和互联网源的优先级是怎么确定的?按速度?不会,因为本地源速度肯定块,网速肯定是赶不上硬盘速度的。按包的版本号吗?只显示版本号高的源吗?

  2. 昊昊荡荡 于 2010-08-26 17:01:03发表:

    引用:
    刚才我试过了 冒失可以 我给你几个建议 1. /etc/yum.repos.d/cdrom.repo 下enabled=0 这是启用软件源的 1是启用 2 . 还有那个数据库放在Packeges文件夹外 cdrom.repo文件里把目的文件修改一下
    2088 发表于 2010-8-26 16:50


    在cdrom.repo中,enabled=1,是启用吧?你的回复里我看的不太明白
    把什么目标文件修改一下?
    那句要修改?

  3. 昊昊荡荡 于 2010-08-26 16:58:39发表:

    这方法我在fedora 13虚拟机上成功过的!

  4. 2088 于 2010-08-26 16:50:39发表:

    刚才我试过了 冒失可以 我给你几个建议 1. /etc/yum.repos.d/cdrom.repo 下enabled=0 这是启用软件源的 1是启用 2 . 还有那个数据库放在Packeges文件夹外 cdrom.repo文件里把目的文件修改一下

  5. 2088 于 2010-08-26 16:25:23发表:

    本地文件我在f13 上没有成功过, 不过你可以搭建本地web服务器 然后把文件copy到web的文件夹下 然后repo 就行了 基本上都是成功的