蓝色风铃

追逐梦想永不放弃!

导航

Redhat ES 6.3 YUM

实验目标:把redhat6.3的光盘中的Packages RPM包当做yum本地安装源。RPM包放到/yum下。

1. 查看 RHEL6 iso镜像

[root@redhat1 cdrom]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 18G 2.3G 15G 14% /
tmpfs 516M 264K 516M 1% /dev/shm
/dev/sda1 291M 33M 244M 12% /boot
/dev/sr0 47M 47M 0 100% /media/CDROM
/dev/sr1 3.5G 3.5G 0 100% /media/RHEL_6.3 x86_64 Disc 1

2.如果想要挂载在指定的位置。可以用如下命令:

例:

[root@redhat1 cdrom]# mount -t iso9660 -o loop /dev/sr1 /mnt/cdrom
[root@redhat1 cdrom]# cd /mnt/cdrom
[root@redhat1 cdrom]# ls
EFI RELEASE-NOTES-es-ES.html RELEASE-NOTES-si-LK.html
EULA RELEASE-NOTES-fr-FR.html RELEASE-NOTES-ta-IN.html
GPL RELEASE-NOTES-gu-IN.html RELEASE-NOTES-te-IN.html
HighAvailability RELEASE-NOTES-hi-IN.html RELEASE-NOTES-zh-CN.html
images RELEASE-NOTES-it-IT.html RELEASE-NOTES-zh-TW.html
isolinux RELEASE-NOTES-ja-JP.html repodata
LoadBalancer RELEASE-NOTES-kn-IN.html ResilientStorage
media.repo RELEASE-NOTES-ko-KR.html RPM-GPG-KEY-redhat-beta
Packages RELEASE-NOTES-ml-IN.html RPM-GPG-KEY-redhat-release
README RELEASE-NOTES-mr-IN.html ScalableFileSystem
RELEASE-NOTES-as-IN.html RELEASE-NOTES-or-IN.html Server
RELEASE-NOTES-bn-IN.html RELEASE-NOTES-pa-IN.html TRANS.TBL
RELEASE-NOTES-de-DE.html RELEASE-NOTES-pt-BR.html
RELEASE-NOTES-en-US.html RELEASE-NOTES-ru-RU.html
[root@redhat1 cdrom]#

3.把光盘的Packages文件夹中的RPM包都拷贝到/yum中。

[root@redhat1 cdrom]# cp -rv Packages /yum

 备注:此时,Packages文件夹被拷贝到/yum/Packages下了。-rv参数的意思是把文件夹拷贝到目标目录中,并显示拷贝过程。
4.安装Createrepo程序
  cmd:
   [root@redhat1 cdrom]# cd /yum/Packages
    root@redhat1 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%]
[root@redhat1 Packages]

备注:此时可能会提示需要安装其他的基础组件,根据屏幕提示操作。这个部分操作没有做记录。

5. 在/yumPackages目录下,执行createrepo  -d /yum/Packages
   [root@redhat1 yum]# createrepo -d /yum/Packages
 
6. 修改yum文件,调用本地源
   cmd:
   cd /etc/yum.repos.d
   cp rehl-source.repo   rehl-source.repo.bak  备份一下。#在Rhel5中,这个文件是rhel-debuginfo.repo。
   vi rehl-source.repo 
   编辑该文件:
   [Packages]                                                                     #括号中的内容可以更改,无特别要求
name=Red Hat Enterprise Linux $releasever - $basearch - Source
baseurl=file:///var/ftp/pub/Packages/                                  #这里是调用本地资源,如果是远程的,则填写ftp://172.16.11.213/pub/Packages
enabled=1                                                                         #这里设置是否使用该yum源,1表示启用。
gpgcheck=0                                                                      #这里表示使用check安装程序的Key,这里就不要验证了吧。
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
 文件rehl-source.repo中的内容如下:

[root@redhat1 yum.repos.d]# cat rhel.repo
[rhel]
name=redhat6.3
baseurl=file:///yum/Packages
enabled=1
gpgcheck=0
gpgkey=file:///yum/RPM-GPG-KEY-redhat-release

 
好了,此时使用yum查看一下源吧:
1.查找ruby相关包

[root@redhat1 yum]# yum search ruby
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
rhel | 2.7 kB 00:00 ...
rhel/primary_db | 3.1 MB 00:00 ...
============================== N/S Matched: ruby ===============================
libselinux-ruby.x86_64 : SELinux ruby bindings for libselinux
ruby-devel.i686 : A Ruby development environment
ruby-devel.x86_64 : A Ruby development environment
ruby-irb.x86_64 : The Interactive Ruby
ruby-libs.i686 : Libraries necessary to run Ruby
ruby-libs.x86_64 : Libraries necessary to run Ruby
ruby-qpid.x86_64 : Ruby language client for AMQP
ruby-qpid-qmf.x86_64 : The QPID Management Framework bindings for ruby
ruby-rdoc.x86_64 : A tool to generate documentation from Ruby source files
ruby.x86_64 : An interpreter of object-oriented scripting language
saslwrapper.i686 : Ruby and Python wrappers for the cyrus sasl library.
saslwrapper.x86_64 : Ruby and Python wrappers for the cyrus sasl library.

Name and summary matches only, use "search all" for everything.

2.清除缓存

[root@redhat1 yum]# yum clean all
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
Cleaning repos: InstallMedia rhel
Cleaning up Everything
[root@redhat1 yum]# yum install bind
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
rhel | 2.7 kB 00:00 ...
rhel/primary_db | 3.1 MB 00:00 ...
Setting up Install Process
Package 32:bind-9.8.2-0.10.rc1.el6.x86_64 already installed and latest version
Nothing to do

3.列出已安装的包

root@redhat1 yum]# yum list |grep ruby
Unable to read consumer identity
libselinux-ruby.x86_64 2.0.94-5.3.el6 rhel
ruby.x86_64 1.8.7.352-7.el6_2 rhel
ruby-devel.i686 1.8.7.352-7.el6_2 rhel
ruby-devel.x86_64 1.8.7.352-7.el6_2 rhel
ruby-irb.x86_64 1.8.7.352-7.el6_2 rhel
ruby-libs.i686 1.8.7.352-7.el6_2 rhel
ruby-libs.x86_64 1.8.7.352-7.el6_2 rhel
ruby-qpid.x86_64 0.7.946106-2.el6 rhel
ruby-qpid-qmf.x86_64 0.14-7.el6_2 rhel
ruby-rdoc.x86_64 1.8.7.352-7.el6_2 rhel
[root@redhat1 yum]#

4.安装包bind

[root@redhat1 yum]# yum install bind
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package bind.x86_64 32:9.8.2-0.10.rc1.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
bind x86_64 32:9.8.2-0.10.rc1.el6 rhel 4.0 M

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

Total download size: 4.0 M
Installed size: 7.2 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
Installing : 32:bind-9.8.2-0.10.rc1.el6.x86_64 1/1
Installed products updated.
Verifying : 32:bind-9.8.2-0.10.rc1.el6.x86_64 1/1

Installed:
bind.x86_64 32:9.8.2-0.10.rc1.el6

Complete!
[root@redhat1 yum]#

最后,yum安装完成!

 

posted on 2015-01-06 22:02  蓝色风铃  阅读(241)  评论(0编辑  收藏  举报