rhel 5 yum光盘源

该方法使用红帽企业版5.x系列(4.X的直接用好像是不行的):

os :

LSB Version:    :core-4.0-ia32:core-4.0-noarch:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-ia32:printing-4.0-noarch
Distributor ID: RedHatEnterpriseServer
Description:    Red Hat Enterprise Linux Server release 5.6 (Tikanga)
Release:        5.6
Codename:       Tikanga

1、首先插入光盘,挂载光驱到/mnt
 [root@agent ~]# mount  /dev/cdrom /mnt
mount: block device /dev/cdrom is write-protected, mounting read-only

2、到/etc/yum.repos.d/下面编辑yum源头文件(* 改文件名任意,但是必须以.repo作为后缀)
[root@agent ~]# cd  /etc/yum.repos.d
[root@agent yum.repos.d]# pwd
/etc/yum.repos.d
[root@agent yum.repos.d]#ls -lh
total 4
-rw-r--r-- 1 root root 741 Nov 13 17:16 rhel-debuginfo.repo

[root@agent yum.repos.d]# vi rhel-debuginfo.repo

[Cluster]
name=Red Hat Enterprise Linux $releasever - $basearch - Cluster
baseurl=file:///mnt/Cluster
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[ClusterStorage]
name=Red Hat Enterprise Linux $releasever - $basearch - ClusterStorage
baseurl=file:///mnt/ClusterStorage
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[Server]
name=Red Hat Enterprise Linux $releasever - $basearch - Server
baseurl=file:///mnt/Server
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[VT]
name=Red Hat Enterprise Linux $releasever - $basearch - VT
baseurl=file:///mnt/VT
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release


3、制作完yum文件以后,预先清空以前可能存在的 cache, 然后根据当前的yum文件(
rhel-debuginfo.repo)重新制作cache.

[root@agent mnt]# yum clean all
Loaded plugins: rhnplugin, security
Cleaning up Everything

[root@agent mnt]# yum makecache


4、这样以后就可以使用本地光盘yum源了
比如使用yum安装mysql:
[root@agent mnt]# yum install mysql
Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Resolving Dependencies
--&gt Running transaction check
---&gt Package mysql.i386 0:5.0.77-4.el5_5.4 set to be updated
--&gt Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================
 Package                   Arch                     Version                                 Repository                  Size
=============================================================================================================================
Installing:
 mysql                     i386                     5.0.77-4.el5_5.4                        Server                     4.8 M

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

Total download size: 4.8 M
Is this ok [y/N]: y





来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/27042095/viewspace-749123/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/27042095/viewspace-749123/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值