Chinaunix首页 | 论坛 | 博客
  • 博客访问: 566898
  • 博文数量: 287
  • 博客积分: 27
  • 博客等级: 民兵
  • 技术积分: 547
  • 用 户 组: 普通用户
  • 注册时间: 2012-01-01 20:20
文章分类

全部博文(287)

文章存档

2015年(1)

2014年(95)

2013年(90)

2012年(101)

分类: LINUX

2013-08-25 11:40:58

原文地址:配置yum使用本地光盘 作者:billing

 1.mount本地CentOS光盘
#mount /dev/cdrom   /mnt/cdrom

2.修改yum配置
#cd /etc/yum.repos.d

# cat CentOS-Media.repo
-------------------------------------------------------------------------------
# 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]
 
[c5-media]
name=CentOS-$releasever - Media
baseurl=file:///media/CentOS/
        file:///media/cdrom/
        file:///media/recorder/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
-------------------------------------------------------------------------------

修改该配置文件:

将baseurl指向mount的光盘
...
baseurl=file:///mnt/cdrom/
...

3.运行安装命令安装软件包。(下面是示例安装gd-devel软件包)

[root@localhost yum.repos.d]#  yum --disablerepo=\* --enablerepo=c5-media install gd-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package gd-devel.i386 0:2.0.33-9.4.el5_4.2 set to be updated
--> Processing Dependency: freetype-devel for package: gd-devel
--> Processing Dependency: fontconfig-devel for package: gd-devel
--> Running transaction check
---> Package fontconfig-devel.i386 0:2.4.1-7.el5 set to be updated
---> Package freetype-devel.i386 0:2.2.1-21.el5_3 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

===================================================================================================================================
 Package                            Arch                   Version                                Repository                  Size
===================================================================================================================================
Installing:
 gd-devel                           i386                   2.0.33-9.4.el5_4.2                     c5-media                    97 k
Installing for dependencies:
 fontconfig-devel                   i386                   2.4.1-7.el5                            c5-media                   168 k
 freetype-devel                     i386                   2.2.1-21.el5_3                         c5-media                   146 k

Transaction Summary
===================================================================================================================================
Install       3 Package(s)
Upgrade       0 Package(s)

Total download size: 412 k
Is this ok [y/N]: y
Downloading Packages:
-----------------------------------------------------------------------------------------------------------------------------------
Total                                                                                              159 MB/s | 412 kB     00:00     
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : freetype-devel                                                                                              1/3 
  Installing     : fontconfig-devel                                                                                            2/3 
  Installing     : gd-devel                                                                                                    3/3 

Installed:
  gd-devel.i386 0:2.0.33-9.4.el5_4.2                                                                                               

Dependency Installed:
  fontconfig-devel.i386 0:2.4.1-7.el5                             freetype-devel.i386 0:2.2.1-21.el5_3                            

Complete!
[root@localhost yum.repos.d]# 
阅读(550) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~