RHEL6 配置 YUM 倉庫

一配置本地 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 [email protected]> - 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) <[email protected]>
 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) <[email protected]>
 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  
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章