您的位置:首页 > 其它

RHEL6 学习配置 YUM 仓库

2012-07-30 17:48 375 查看
一配置本地 YUM 源

--1.1 实验环境

RHEL6:虚拟机

--1.2 挂载光驱

[root@redhat6 yum.repos.d]# mount /dev/cdrom /mnt

mount: block device /dev/sr0 is write-protected, mounting read-only

备注:将光盘 ISO 文件挂载到目录 /mnt

--1.3 创建本地目录,用来 copy 光盘包

[root@redhat6 local_repo]# mkdir -p /opt/rpm/local_repo

--1.4 copy RPM 包到指定目录

[root@redhat6 log]# cd /mnt/Packages/

[root@redhat6 Packages]# cp * /opt/rpm/local_repo

--1.5 安装 createrepo 包

[root@redhat6 local_repo]# rpm -ivh createrepo-0.9.8-4.el6.noarch.rpm

warning: createrepo-0.9.8-4.el6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY

error: Failed dependencies:

deltarpm is needed by createrepo-0.9.8-4.el6.noarch

python-deltarpm is needed by createrepo-0.9.8-4.el6.noarch

You have new mail in /var/spool/mail/root

--1.5.1根据提示,安装需要的包



[root@redhat6 local_repo]# rpm -ivh deltarpm-3.5-0.5.20090913git.el6.i686.rpm

warning: deltarpm-3.5-0.5.20090913git.el6.i686.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY

Preparing... ########################################### [100%]

1:deltarpm ########################################### [100%]

[root@redhat6 local_repo]#

[root@redhat6 local_repo]#

[root@redhat6 local_repo]# rpm -ivh python-deltarpm-3.5-0.5.20090913git.el6.i686.rpm

warning: python-deltarpm-3.5-0.5.20090913git.el6.i686.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY

Preparing... ########################################### [100%]

1:python-deltarpm ########################################### [100%]

[root@redhat6 local_repo]# rpm -ivh createrepo-0.9.8-4.el6.noarch.rpm

warning: createrepo-0.9.8-4.el6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY

Preparing... ########################################### [100%]

1:createrepo ########################################### [100%]
备注:createrepo 包安装成功

--1.6 创建 repo 数据库


[root@redhat6 local_repo]# createrepo -d /opt/rpm/local_repo

1944/2804 - MAKEDEV-3.24-6.el6.i686.rpm

iso-8859-1 encoding on Ville Skytt?ville.skytta@iki.fi> - 2.8.2-2

2804/2804 - perl-Archive-Extract-0.38-119.el6_1.1.i686.rpm

Saving Primary metadata

Saving file lists metadata

Saving other metadata

Generating sqlite DBs

Sqlite DBs complete

备注:这个步骤需要点时间。

--1.7 编写 /etc/yum.repos.d/local_repo.repo 文件

文件 /etc/yum.repos.d/local_repo.repo 内容如下。

[rhel-source]

name=Red Hat Enterprise Linux Local repo ##仓库描述

baseurl=file:///opt/rpm/local_repo ##软件仓库位置

enabled=1 ##是否启用

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release ##签名秘钥
二 yum 源测试

--2.1 查找 ruby 相关包



[root@redhat6 yum.repos.d]# yum search ruby

Loaded plugins: product-id, refresh-packagekit, security, subscription-manager

Updating certificate-based repositories.

Repository rhel-source is listed more than once in the configuration

rhel-source | 2.7 kB 00:00 ...

rhel-source/primary_db | 2.5 MB 00:00 ...

======================================================== N/S Matched: ruby =========================================================

ruby-irb.i686 : The Interactive Ruby

ruby-libs.i686 : Libraries necessary to run Ruby

ruby-qpid.i686 : Ruby language client for AMQP

ruby-qpid-qmf.i686 : The QPID Management Framework bindings for ruby

ruby.i686 : An interpreter of object-oriented scripting language

saslwrapper.i686 : Ruby and Python wrappers for the cyrus sasl library.

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

--2.2 安装包 ruby.i68

[root@redhat6 yum.repos.d]# yum install ruby.i686

Loaded plugins: product-id, refresh-packagekit, security, subscription-manager

Updating certificate-based repositories.

Repository rhel-source is listed more than once in the configuration

Setting up Install Process

Resolving Dependencies

--> Running transaction check

---> Package ruby.i686 0:1.8.7.352-3.el6 will be installed

--> Processing Dependency: ruby-libs = 1.8.7.352-3.el6 for package: ruby-1.8.7.352-3.el6.i686

--> Processing Dependency: libruby.so.1.8 for package: ruby-1.8.7.352-3.el6.i686

--> Running transaction check

---> Package ruby-libs.i686 0:1.8.7.352-3.el6 will be installed

--> Processing Dependency: libreadline.so.5 for package: ruby-libs-1.8.7.352-3.el6.i686

--> Running transaction check

---> Package compat-readline5.i686 0:5.2-17.1.el6 will be installed

--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================================================

Package Arch Version Repository Size

====================================================================================================================================

Installing:

ruby i686 1.8.7.352-3.el6 rhel-source 532 k

Installing for dependencies:

compat-readline5 i686 5.2-17.1.el6 rhel-source 127 k

ruby-libs i686 1.8.7.352-3.el6 rhel-source 1.6 M

Transaction Summary

====================================================================================================================================

Install 3 Package(s)

Total download size: 2.3 M

Installed size: 7.7 M

Is this ok [y/N]: y

Downloading Packages:

------------------------------------------------------------------------------------------------------------------------------------

Total 16 MB/s | 2.3 MB 00:00

warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY

Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

Importing GPG key 0xFD431D51:

Userid : Red Hat, Inc. (release key 2) <security@redhat.com>

Package: redhat-release-server-6Server-6.2.0.3.el6.i686 (@anaconda-RedHatEnterpriseLinux-201111171035.i386/6.2)

From : /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

Is this ok [y/N]: y

Importing GPG key 0x2FA658E0:

Userid : Red Hat, Inc. (auxiliary key) <security@redhat.com>

Package: redhat-release-server-6Server-6.2.0.3.el6.i686 (@anaconda-RedHatEnterpriseLinux-201111171035.i386/6.2)

From : /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

Is this ok [y/N]: y

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

Warning: RPMDB altered outside of yum.

Installing : compat-readline5-5.2-17.1.el6.i686 1/3

Installing : ruby-libs-1.8.7.352-3.el6.i686 2/3

Installing : ruby-1.8.7.352-3.el6.i686 3/3

Installed products updated.

Installed:

ruby.i686 0:1.8.7.352-3.el6

Dependency Installed:

compat-readline5.i686 0:5.2-17.1.el6 ruby-libs.i686 0:1.8.7.352-3.el6

Complete!

备注:本地 yum 源配置成功。

--2.3 列出已安装的包


[root@redhat6 yum.repos.d]# yum list | grep ruby

Repository rhel-source is listed more than once in the configuration

ruby.i686 1.8.7.352-3.el6 @rhel-source

ruby-libs.i686 1.8.7.352-3.el6 @rhel-source

ruby-irb.i686 1.8.7.352-3.el6 rhel-source

ruby-qpid.i686 0.7.946106-2.el6 rhel-source

ruby-qpid-qmf.i686 0.12-6.el6 rhel-source
--2.4 查看包信息


[root@redhat6 yum.repos.d]# yum info ruby.i686

Loaded plugins: product-id, refresh-packagekit, security, subscription-manager

Updating certificate-based repositories.

Repository rhel-source is listed more than once in the configuration

Installed Packages

Name : ruby

Arch : i686

Version : 1.8.7.352

Release : 3.el6

Size : 1.8 M

Repo : installed

From repo : rhel-source

Summary : An interpreter of object-oriented scripting language

URL : http://www.ruby-lang.org/

License : Ruby or GPLv2

Description : Ruby is the interpreted scripting language for quick and easy

: object-oriented programming. It has many features to process text

: files and to do system management tasks (as in Perl). It is simple,

: straight-forward, and extensible.
--2.5 删除 yum 缓存数据


[root@redhat6 yum.repos.d]# yum clean all

Loaded plugins: product-id, refresh-packagekit, security, subscription-manager

Updating certificate-based repositories.

Repository rhel-source is listed more than once in the configuration

Cleaning repos: rhel-source

Cleaning up Everything
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: