[root@redhat6log]# cd /mnt/Packages/ [root@redhat6 Packages]# cp * /opt/rpm/local_repo
1.5 安装 createrepo 包
1 2 3 4 5 6
[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
[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 相关包
1 2 3 4 5 6 7 8 9 10 11 12 13 14
[root@redhat6 yum.repos.d]# yum searchruby Loaded plugins: product-id, refresh-packagekit, security, subscription-manager Updating certificate-based repositories. Repository rhel-sourceis 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 forruby 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.
[root@redhat6 yum.repos.d]# yum install ruby.i686Loaded 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 forpackage: ruby-1.8.7.352-3.el6.i686 --> Processing Dependency: libruby.so.1.8forpackage: 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.5forpackage: 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](file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release) Importing GPG key 0xFD431D51: Userid : Red Hat, Inc. (release key 2) <[security@redhat.com](mailto: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](mailto: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 列出已安装的包
1 2 3 4 5 6 7
[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 查看包信息
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
[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/](http://www.ruby-lang.org/) License : Rubyor GPLv2 Description : Rubyis the interpreted scripting language for quick and easy : object-oriented programming. It has many features to process text : filesand to do system management tasks (as in Perl). It is simple, : straight-forward, and extensible.
2.5 删除 yum 缓存数据
1 2 3 4 5 6
[root@redhat6 yum.repos.d]# yum clean all Loaded plugins: product-id, refresh-packagekit, security, subscription-manager Updating certificate-based repositories. Repository rhel-sourceis listed more than once in the configuration Cleaning repos: rhel-source Cleaning up Everything