Oracle Enterprise Linux 6.0配置本地yum

【声明】:本文可随意转载,但请注明出处:http://www.cnblogs.com/hanxi/

我安装的linux系统是Oracle Linux,其全称为Oracle Enterprise Linux。是从电驴网下载的:http://www.verycd.com/topics/2888648/

下面的方法是我自己实验成功了的。

1.创建一个存放iso镜像或光盘内容的目录

[root@hanxi-workstation hanxi]# mkdir /home/hanxi/yum

并从光盘介质或iso镜像文件中的所有文件拷贝到刚创建的目录里(/home/hanxi/yum)。

如果是光盘可以使用命令:

[root@hanxi-workstation hanxi]# cp -r  /media/cdrom  /home/hanxi/yum

ps:/media/cdrom是mount光驱的目录。

我用的是iso镜像文件,我就直接使用鼠标把文件复制到 /home/hanxi/yum

ps:注意是iso文件里的所有文件,不是iso文件。

复制完成后是这个样的,如下图

2.安装createrepo

createrepo是配置YUM源的配置工具,检查当前是否已经安装createrepo包的安装情况:

[root@hanxi-workstation hanxi]# rpm  -qa |grep  createrepo  

如果显示为尚未安装,则需要执行如下的命令完成安装:

[root@hanxi-workstation hanxi]# rpm  -ivh  /home/hanxi/yum/Packages/createrepo-0.9.8-4.el6.noarch.rpm

ps:版本因操作系统的版本有所区别,请查找当前系统的createrepo版本rpm包进行安装,可以到/home/hanxi/yum/Packages/文件夹下查找,如下图:

3.创建yum repository的xml-rpm-metadata

执行如下命令:

[root@hanxi-workstation hanxi]# createrepo  -g  /home/hanxi/yum/Server/repodata/repomd.xml  /home/hanxi/yum/Server/

[root@hanxi-workstation hanxi]# createrepo  -g  /home/hanxi/yum/HighAvailability/repodata/repomd.xml  /home/hanxi/yum/HighAvailability/

[root@hanxi-workstation hanxi]# createrepo  -g  /home/hanxi/yum/LoadBalancer/repodata/repomd.xml  /home/hanxi/yum/LoadBalancer/

[root@hanxi-workstation hanxi]# createrepo  -g  /home/hanxi/yum/ResilientStorage/repodata/repomd.xml  /home/hanxi/yum/ResilientStorage/

ps:上面每条命令可能都有段处理时间,注意要等待,如下图:

执行createrepo命令后系统会自动扫描相关目录,将rpm包加入到YUM源的数据库中。

4.创建本地yum客户端的repo文件

配置使用本地yum repository:

[root@hanxi-workstation hanxi]# cd  /etc/yum.repos.d/

[root@hanxi-workstation yum.repos.d]# gedit local.repo 

ps:名字可以随便起,但是要以.repo为后缀

接下来在文件中添加如下内容后保存:

[HighAvailability]
name= HighAvailability
baseurl=
file:/home/hanxi/yum/HighAvailability
enabled=
1
gpgcheck=
0
gpgkey=
file:/home/hanxi/yum/RPM-GPG-KEY-oracle

[LoadBalancer]
name= LoadBalance
baseurl=
file:/home/hanxi/yum/LoadBalancer
enabled=
1
gpgcheck=
0
gpgkey=
file:/home/hanxi/yum/RPM-GPG-KEY-oracle

[ResilientStorage]
name=ResilientStorage
baseurl=
file:/home/hanxi/yum/ResilientStorage
enabled=
1
gpgcheck=
0
gpgkey=
file:/home/hanxi/yum/RPM-GPG-KEY-oracle

[Server]
name=Server
baseurl=
file:/home/hanxi/yum/Server
gpgcheck=
0
enabled=
1
gpgkey=
file:/home/hanxi/yum/RPM-GPG-KEY-oracle

如下图:

5.测试使用yum来安装软件包

可以按下面的菜单路径打开添加/删除软件:系统-->管理-->添加/删除软件

现在可以在搜索框里搜索到软件了。。。

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

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

++++++++++++++++++++++++++++++++++++++++++++++++++++++

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

+++++++++++++++++++++++++
小小经验,一起分享,分享快乐

!!!!!!!!!!!!!!!!!!

posted @ 2011-06-01 13:43  涵曦  阅读(11038)  评论(0编辑  收藏  举报