redhat 6.4 yum 本地配置简记

 

准备工作

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

1. 加载光驱

 将iso镜像文件放入光驱中
# mount /dev/cdrom /mnt/
mount: block device /dev/sr0 is write-protected, mounting read-only

  

2. 安装createrepo软件包
 
# cd /mnt/Packages/
 
 rpm -ivh deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm 
 rpm -ivh python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm
 rpm -ivh createrepo-0.9.9-17.el6.noarch.rpm

 

3. 从光驱cp软件包安装到系统
mkdir /app/myyum
cp -r /mnt/Packages/ /app/myyum/

 

 
配置yum
---------------------------------------------------
 
4. 生成依赖关系
 
 createrepo -g /mnt/repodata/cda5429be6f36ce1348e8f897f4fc96aa00d5727c75e9e5a0b5dc40d22a51116-comps-rhel6-Server.xml /app/myyum/Packages/

  

5. 编辑 yum 仓库配置文件
 
cd /etc/yum.repos.d/ 
cp rhel-source.repo rhel-source.repo.bak
 
vi rhel-source.repo
[myyum]
name=Red Hat Yum
baseurl=file:///app/myyum/Packages/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[rhel-source-beta]
name=Red Hat Enterprise Linux $releasever Beta - $basearch - Source
baseurl=ftp://ftp.redhat.com/pub/redhat/linux/beta/$releasever/en/os/SRPMS/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

  

 
6. 测试配置是否正常
 
yum grouplist
 
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Setting up Group Process
myyum                                                                                                                   | 3.8 kB     00:00 ...
myyum/primary_db                                                                                                        | 2.9 MB     00:00 ...
myyum/group_gz     
至此,yum安装成功。
 
 
7. yum 安装软件
 
使用rpm 安装时,可以看到需要依赖书当然软件包
rpm -ivh openssl-devel-1.0.0-27.el6.x86_64.rpm
warning: openssl-devel-1.0.0-27.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
error: Failed dependencies:
 krb5-devel is needed by openssl-devel-1.0.0-27.el6.x86_64
 
使用 yum 安装
 
yum install openssl-devel-1.0.0-27.el6.x86_64.rpm -y

  

-y 表示在询问是否需要安装相关依赖包时,自动回应为 yes
 
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Setting up Install Process
Examining openssl-devel-1.0.0-27.el6.x86_64.rpm: openssl-devel-1.0.0-27.el6.x86_64
Marking openssl-devel-1.0.0-27.el6.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package openssl-devel.x86_64 0:1.0.0-27.el6 will be installed
--> Processing Dependency: krb5-devel for package: openssl-devel-1.0.0-27.el6.x86_64
--> Running transaction check
---> Package krb5-devel.x86_64 0:1.10.3-10.el6 will be installed
--> Processing Dependency: libselinux-devel for package: krb5-devel-1.10.3-10.el6.x86_64
--> Processing Dependency: libcom_err-devel for package: krb5-devel-1.10.3-10.el6.x86_64
--> Processing Dependency: keyutils-libs-devel for package: krb5-devel-1.10.3-10.el6.x86_64
--> Running transaction check
---> Package keyutils-libs-devel.x86_64 0:1.4-4.el6 will be installed
---> Package libcom_err-devel.x86_64 0:1.41.12-14.el6 will be installed
---> Package libselinux-devel.x86_64 0:2.0.94-5.3.el6 will be installed
--> Processing Dependency: libsepol-devel >= 2.0.32-1 for package: libselinux-devel-2.0.94-5.3.el6.x86_64
--> Processing Dependency: pkgconfig(libsepol) for package: libselinux-devel-2.0.94-5.3.el6.x86_64
--> Running transaction check
---> Package libsepol-devel.x86_64 0:2.0.41-4.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================================================================
 Package                           Arch                 Version                         Repository                                        Size
===============================================================================================================================================
Installing:
 openssl-devel                     x86_64               1.0.0-27.el6                    /openssl-devel-1.0.0-27.el6.x86_64               2.1 M
Installing for dependencies:
 keyutils-libs-devel               x86_64               1.4-4.el6                       myyum                                             28 k
 krb5-devel                        x86_64               1.10.3-10.el6                   myyum                                            493 k
 libcom_err-devel                  x86_64               1.41.12-14.el6                  myyum                                             31 k
 libselinux-devel                  x86_64               2.0.94-5.3.el6                  myyum                                            136 k
 libsepol-devel                    x86_64               2.0.41-4.el6                    myyum                                             64 k

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

Total size: 2.8 M
Total download size: 753 k
Installed size: 4.7 M
Downloading Packages:
-----------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                          6.4 MB/s | 753 kB     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.4.0.4.el6.x86_64 (@anaconda-RedHatEnterpriseLinux-201301301459.x86_64/6.4)
 From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
Importing GPG key 0x2FA658E0:
 Userid : Red Hat, Inc. (auxiliary key) <security@redhat.com>
 Package: redhat-release-server-6Server-6.4.0.4.el6.x86_64 (@anaconda-RedHatEnterpriseLinux-201301301459.x86_64/6.4)
 From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
  Installing : libcom_err-devel-1.41.12-14.el6.x86_64                                                                                      1/6 
  Installing : keyutils-libs-devel-1.4-4.el6.x86_64                                                                                        2/6 
  Installing : libsepol-devel-2.0.41-4.el6.x86_64                                                                                          3/6 
  Installing : libselinux-devel-2.0.94-5.3.el6.x86_64                                                                                      4/6 
  Installing : krb5-devel-1.10.3-10.el6.x86_64                                                                                             5/6 
  Installing : openssl-devel-1.0.0-27.el6.x86_64                                                                                           6/6 
  Verifying  : krb5-devel-1.10.3-10.el6.x86_64                                                                                             1/6 
  Verifying  : libsepol-devel-2.0.41-4.el6.x86_64                                                                                          2/6 
  Verifying  : keyutils-libs-devel-1.4-4.el6.x86_64                                                                                        3/6 
  Verifying  : openssl-devel-1.0.0-27.el6.x86_64                                                                                           4/6 
  Verifying  : libselinux-devel-2.0.94-5.3.el6.x86_64                                                                                      5/6 
  Verifying  : libcom_err-devel-1.41.12-14.el6.x86_64                                                                                      6/6 

Installed:
  openssl-devel.x86_64 0:1.0.0-27.el6                                                                                                          

Dependency Installed:
  keyutils-libs-devel.x86_64 0:1.4-4.el6          krb5-devel.x86_64 0:1.10.3-10.el6           libcom_err-devel.x86_64 0:1.41.12-14.el6       
  libselinux-devel.x86_64 0:2.0.94-5.3.el6        libsepol-devel.x86_64 0:2.0.41-4.el6       

Complete!
 

  

从上面的信息可以看到,yum自动安装了五个依赖包,如果使用 rpm 的话,就需要通过报错一个个地安装这五个文件。
 
 
 
 
posted @ 2015-10-13 11:05  方诚  阅读(1045)  评论(1编辑  收藏  举报