Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1684878
  • 博文数量: 391
  • 博客积分: 8464
  • 博客等级: 中将
  • 技术积分: 4589
  • 用 户 组: 普通用户
  • 注册时间: 2008-12-13 15:12
个人简介

狮子的雄心,骆驼的耐力,孩子的执著!

文章分类

全部博文(391)

文章存档

2023年(4)

2018年(9)

2017年(13)

2016年(18)

2014年(7)

2013年(29)

2012年(61)

2011年(49)

2010年(84)

2009年(95)

2008年(22)

分类: LINUX

2012-02-23 14:16:38

[root@localhost CentOS]# mkdir /media/CentOS

把光盘加载到本地

[root@localhost CentOS]# mount /dev/cdrom /media/CentOS
或者
[root@localhost CentOS]# mount -o loop /tmp/CentOS-6.4-x86_64-bin-DVD1.iso /media/CentOS

在/etc/yum.repos.d/目录下,有两个文件

CentOS-Base.repo和CentOS-Media.repo

其中CentOS-Base.repo记录着网络上的yum源的地址和路径信息等

CentOS-Media.repo记录着可以从本地作为yum源的介质和路径。其中还有这样一个说明:

# CentOS-Media.repo
#
# This repo is used to mount the default locations for a CDROM / DVD on
# CentOS-5. You can use this repo and yum to install items directly off the
# DVD ISO that we release.
#
# To use this repo, put in your DVD and use it with the other repos too:
# yum --enablerepo=c5-media [command]
#
# or for ONLY the media repo, do this:
#
# yum --disablerepo=\* --enablerepo=c5-media [command]

[c6-media]
name=CentOS-$releasever - Media
baseurl=file:///media/CentOS
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-beta

我们只需编辑下bashurl ,将自己的光盘路径写入就可以了。

如果觉得自己的光盘的源足够用了。不需要网络源,或者没有网络。

查询命令所属软件包:

# yum --disablerepo=\* --enablerepo=c6-media whatprovides */lspci

c6-media/filelists_db                                                                                        | 4.7 MB     00:01 ...
pciutils-3.1.4-9.el6.i686 : PCI bus related utilities
Repo        : c6-media
Matched from:
Filename    : /sbin/lspci



可以使用yum --disablerepo=\* --enablerepo=c6-media [command],其中command可以是info, install, 等等。

yum命令允许使用本地media介质的源而已。正确的命令如下(安装pciutils为例):

#yum --disablerepo=\* --enablerepo=c6-media install pciutils

  Installing     : pciutils-3.1.4-9.el6.i686                                                                                    1/1

Installed:
  pciutils.i686 0:3.1.4-9.el6                                                                                                       

Complete!



比如安装gdb

[root@centos cdrom]# yum --disablerepo =\* --enablerepo=c6-media install gdb
Loading " installonlyn " plugin
Setting up Install Process
Setting up repositories
Reading repository metadata in from local files
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for gdb to pack into transaction set .
gdb - 6.5 - 25 .el5.i386.rpm 100 % |=========================| 56 kB 00 : 00
---> Package gdb.i386 0 : 6.5 - 25 .el5 set to be updated
--> Running transaction check

Dependencies Resolved

=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
gdb i386 6.5 - 25 .el5 c5 - media 3.1 M

Transaction Summary
=============================================================================
Install 1 Package(s)
Update 0 Package(s)
Remove 0 Package(s)

Total download size: 3.1 M
Is this ok [y / N]: y
Downloading Packages:
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: gdb ######################### [ 1 / 1 ]

Installed: gdb.i386 0 : 6.5 - 25 .el5
Complete !
[root@centos cdrom]#

在使用yum进行install时,经常会出现下面的错误
warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID 1ac70ce6
导致安装不能进行。解决方法如下:
[root@localhost CentOS]# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
[root@localhost CentOS]# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-beta

阅读(1903) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~