该方法使用红帽企业版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
--> Running transaction check
---> Package mysql.i386 0:5.0.77-4.el5_5.4 set to be updated
--> 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
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
--> Running transaction check
---> Package mysql.i386 0:5.0.77-4.el5_5.4 set to be updated
--> 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/