Oracle linux6.1配置yum本地源

一、准备工作
1. Linux安装盘插入光驱
2. 挂载光驱

[root@localhost ~]# mount /dev/cdrom /mnt/ 

mount: block device /dev/sr0 is write-protected, mounting read-only
如果光驱没有插入光盘,可把iso镜像拷贝到服务器加载:mount -t iso9660 -o loop /soft/OracleLinux-R6-U1-Server-x86_64-dvd.iso /mnt
[root@localhost ~]#

3. 安装createrepo软件包 ---> 这是一个解决依赖性的工具
[root@localhost ~]# cd /mnt/Packages/
[root@localhost Packages]# 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:
python-deltarpm is needed by createrepo-0.9.8-4.el6.noarch 
[root@localhost Packages]# rpm -ivh python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm
warning: python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
error: Failed dependencies:
deltarpm = 3.5-0.5.20090913git.el6 is needed by python-deltarpm-3.5-0.5.20090913git.el6.x86_64
[root@localhost Packages]# rpm -ivh deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm
warning: deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:deltarpm ########################################### [100%]
[root@localhost Packages]# rpm -ivh python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm
warning: python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:python-deltarpm ########################################### [100%]
[root@localhost Packages]# rpm -ivh createrepo-0.9.8-4.el6.noarch.rpm  
warning: createrepo-0.9.9-17.el6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:createrepo ########################################### [100%]
[root@localhost Packages]#

4. 拷贝光驱中的rpm包到本系统中,并创建对应的目录
[root@localhost Packages]# mkdir -pv /var/ftp/pub
mkdir: created directory `/var/ftp‘
mkdir: created directory `/var/ftp/pub‘
[root@localhost Packages]# cp -R /mnt/Packages /var/ftp/pub/

注:我这里没有此步骤


二、 开始搭建yum
1. 生成依赖关系
[root@localhost Packages]# createrepo -g /mnt/repodata/cda5429be6f36ce1348e8f897f4fc96aa00d5727c75e9e5a0b5dc40d22a51116-comps-ol6-Server.xml /var/ftp/pub/Packages/
Spawning worker 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

注:我这里没有做此步骤,最后也可以。不知道这步骤是不是必须的。

2. 编辑yum仓库配置文件
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# vi local.repo
[myyum]
name=olinux Myyum
baseurl=file:///mnt/Server
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle

3. 至此本地yum安装完毕,测试下是否能够正常使用
[root@localhost yum.repos.d]# 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 | 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
[root@localhost yum.repos.d]#

OK !!!

推荐阅读:

RedHat Linux 本地yum源的配置 http://www.linuxidc.com/Linux/2013-08/88217.htm

RedHat 6.2 Linux修改yum源免费使用CentOS源 http://www.linuxidc.com/Linux/2013-07/87383.htm

配置EPEL YUM源 http://www.linuxidc.com/Linux/2012-10/71850.htm

Redhat 本地yum源配置 http://www.linuxidc.com/Linux/2012-11/75127.htm

yum的配置文件说明 http://www.linuxidc.com/Linux/2013-04/83298.htm

RedHat 6.1下安装yum(图文) http://www.linuxidc.com/Linux/2013-06/86535.htm

YUM 安装及清理 http://www.linuxidc.com/Linux/2013-07/87163.htm

 

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。