码迷,mamicode.com
首页 > 其他好文 > 详细

RedHat Enterprise版本搭建本地Yum库

时间:2014-10-21 02:23:31      阅读:224      评论:0      收藏:0      [点我收藏+]

标签:linux软件安装

RedHat  Enterprise版本目前广泛的应用在各种生产环境中。由于没有购买正式的授权,导致无法正常使用yum安装,或者由于网络限制也导致无法使用Yum安装。而手动安装rpm包又会引来很多依赖关系的问题。故有时我们需要创建本地yum库。本文介绍创建本地yum库的方法。
测试环境: RedHat Enterprise 6.4和RedHat Enterprise 6.5

步骤如下
(1)将系统安装光盘挂载到系统中 mount /dev/cdrom /mnt/
(2)cd /mnt/Packages
(3) rpm -ivh deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm
(4)rpm -ivh  python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm
(5) rpm -ivh createrepo-0.9.9-17.el6.noarch.rpm
(6) mkdir -p /var/yumlocal
 (7)cp -R /mnt/Packages /var/yumlocal
(8)cd /mnt/Packages
(9)执行createrepo -g /mnt/repodata/cda5429be6f36ce1348e8f897f4fc96aa00d5727c75e9e5a0b5dc40d22a51116-comps-rhel6-Server.xml /var/yumlocal
注意如果没有cda5429be6f36ce1348e8f897f4fc96aa00d5727c75e9e5a0b5dc40d22a51116-comps-rhel6-Server.xml,请ls /mnt/repdata查看.xml结尾的文件,将此文件名替换到上面命令中。
出现以下内容代表成功:
Spawningworker 0 with 3720 pkgs
Workers Finished
Gathering worker results
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete 
(10)cd /etc/yum.repos.d
(11)cp rhel-source.repo rhel-source.repo.bak
(12) vim rhel-source.repo 编辑如下,然后保存退出。
 [myyum]
name=RedHatMyLocalyum
baseurl=file:///var/yumlocal/Packages/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
(13)测试本地Yum是否已经可用,执行yumgrouplist
出现以下内容代表成功
 Loadedplugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered toRed HatSubscription Management. You can usesubscription-manager to register.
Setting up Group Process
myyum | 3.8 kB 00:00 ...
myyum/primary_db | 3.1 MB 00:00 ...
myyum/group_gz | 204 kB 00:00 ...
Installed Groups:
Additional Development
Base
Debugging Tools
Desktop
Desktop Debugging and Performance Tools
Desktop Platform
Dial-up Networking Support
Directory Client
Network file system client
Assamese Support [as]
Available Language Groups:
Afrikaans Support [af]
Albanian Support [sq]
Amazigh Support [ber]
Azerbaijani Support [az]
Ukrainian Support [uk]
Upper Sorbian Support [hsb]
Uzbek Support [uz]
Vietnamese Support [vi]
Walloon Support [wa]
Welsh Support [cy]
Xhosa Support [xh]
Zulu Support [zu]
Done

最后 unmount /mnt

本文出自 “张舵主” 博客,请务必保留此出处http://zdzhu.blog.51cto.com/6180070/1566116

RedHat Enterprise版本搭建本地Yum库

标签:linux软件安装

原文地址:http://zdzhu.blog.51cto.com/6180070/1566116

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!