标签:
http://blog.chinaunix.net/uid-14504139-id-3852208.html
安装linux的rpm包经常遇到要安装一堆依赖包的问题,使用yum可以顺利安装,但是如果无法连接到网络的情况下,也希望使用yum来流畅安装rpm。
1.先从系统盘中安装以下3个rpm包
deltarpm、python-deltarpm、createrepo
[root@rhel63 Packages]# rpm -ivh deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm
warning: deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:deltarpm ########################################### [100%]
[root@rhel63 Packages]# rpm -ivh python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm
warning: python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:python-deltarpm ########################################### [100%]
[root@rhel63 Packages]# rpm -ivh createrepo-0.9.8-5.el6.noarch.rpm
warning: createrepo-0.9.8-5.el6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:createrepo ########################################### [100%]
2.在/media下面扫描光盘的rpm包,作为来源。
[root@rhel63 ~]# cd /media
创建repo,需要扫描一段时间
[root@rhel63 media]# createrepo .
3274/3653 - RHEL_6.3 x86_64 Disc 1/Packages/system-config-keyboard-base-1.3.1-4.
iso-8859-1 encoding on Ville Skytt?<ville.skytta@iki.fi> - 2.8.2-2
3653/3653 - RHEL_6.3 x86_64 Disc 1/Packages/zsh-4.3.10-5.el6.x86_64.rpm
Saving Primary metadata
Saving file lists metadata
Saving other metadata
[root@rhel63 yum.repos.d]# cd /etc/yum.repos.d
编辑一个repo文件,内容如下即可。名字可以自己随便取,这里取名为cc
[root@rhel63 yum.repos.d]# vi cc.repo
[cc]
baseurl=file:///media
enabled=1
gpgcheck=0
3.安装方法如下
yum install 包名* -y
安装时会自动在cd中找寻依赖包进行安装
[root@rhel63 yum.repos.d]# yum install glibc-headers* -y
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
Repository ‘cc‘ is missing name in configuration, using id
cc | 1.3 kB 00:00 ...
cc/primary | 1.3 MB 00:00 ...
cc 3653/3653
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package glibc-headers.x86_64 0:2.12-1.80.el6 will be installed
--> Processing Dependency: kernel-headers >= 2.2.1 for package: glibc-headers-2.12-1.80.el6.x86_64
--> Processing Dependency: kernel-headers for package: glibc-headers-2.12-1.80.el6.x86_64
--> Running transaction check
---> Package kernel-headers.x86_64 0:2.6.32-279.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
====================================================================================================================================
Package Arch Version Repository Size
====================================================================================================================================
Installing:
glibc-headers x86_64 2.12-1.80.el6 cc 600 k
Installing for dependencies:
kernel-headers x86_64 2.6.32-279.el6 cc 1.9 M
Transaction Summary
====================================================================================================================================
Install 2 Package(s)
Total download size: 2.5 M
Installed size: 4.5 M
Downloading Packages:
------------------------------------------------------------------------------------------------------------------------------------
Total 58 MB/s | 2.5 MB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
Installing : kernel-headers-2.6.32-279.el6.x86_64 1/2
Installing : glibc-headers-2.12-1.80.el6.x86_64 2/2
Installed products updated.
Verifying : glibc-headers-2.12-1.80.el6.x86_64 1/2
Verifying : kernel-headers-2.6.32-279.el6.x86_64 2/2
Installed:
glibc-headers.x86_64 0:2.12-1.80.el6
Dependency Installed:
kernel-headers.x86_64 0:2.6.32-279.el6
Complete!
标签:
原文地址:http://www.cnblogs.com/habibah-chang/p/4600355.html