如何使用createrepo命令更新yum仓库库

yum的使用及配置
最近由于服务器需求,需要在公司内网搭建内网yum源。
搭建内网yum源需要分以下几个步骤,如下:
1、 yum是什么
2、 repo文件是什么
3、 repo文件内容详解
4、 yum服务器端配置
5、 yum客户端配置
6、 保存yum安装的软件包
7、 更新rpm包
一、yum是什么
yum(全称为Yellowdog Updater Modified)是一个在CentOS、RedHat和Fedora操作系统中使用的Shell前端软件包管理器。
最近由于服务器需求,需要在公司内网搭建内网yum源。
搭建内网yum源需要分以下几个步骤,如下:
1、 yum是什么
2、 repo文件是什么
3、 repo文件内容详解
4、 yum服务器端配置
5、 yum客户端配置
6、 保存yum安装的软件包
7、 更新rpm包
一、yum是什么
yum(全称为Yellowdog Updater Modified)是一个在CentOS、RedHat和Fedora操作系统中使用的Shell前端软件包管理器。
yum主要管理基于rpm的软件包,它可以自动升级、安装、删除rpm软件包,同时它还能够自动查找并解决rpm包之间的依赖关系,并且无需管理员逐个、手工的去安装每一个rpm包,使管理员在维护Linux主机时更加轻松自如。
yum可以从一个或多个repo文件中配置的repo仓库,通过http或ftp协议从repo仓库获得必要的信息,然后下载相关的软件包。这样,本地用户通过建立不同的repo仓库,在有Internet连接时就能方便进行系统的升级和维护工作。
repo仓库可以通过createrepo或yum-arch命令进行创建,也能够用别人已经创建好的repo仓库作为yum源,在此我们主要探讨通过createrepo命令创建的repo仓库。
有关yum命令的使用帮助信息,我们可以通过man yum命令进行查看,如下:
二、repo文件是什么
通过第一章,我们知道repo文件是CentOS、RedHat和Fedora操作系统中yum源(软件仓库)的配置文件,通常一个repo文件定义了一个或者多个软件源。
例如:我们将从哪里下载需要安装或者升级的软件包,repo文件中都进行了相关的配置,而这些配置将会被yum读取和应用。
三、repo文件内容详解
一个标准的centos的repo文件内容如下:
name=CentOS-$releasever – Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
各个选项说明如下:
该选项是定义软件源的名称,该名称是可以自定义,同时在该服务器上所有repo文件中是唯一的。注意:方括号里面不能有空格。
name=CentOS-$releasever – Base
该选项是定义软件仓库的名称,$releasever变量定义了发行版本,通常是5,6,7等数字。
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
这是指定镜像服务器的地址列表,通常是开启的。我们可以尝试,将$releasever和$basearch替换成自己对应的版本和架构,例如6.6和x86_64,在浏览器中打开,我们就能看到一长串镜可用的镜像服务器地址列表。如下:
选择自己访问速度较快的镜像服务器地址复制并粘贴到repo文件中的baseurl选项中,我们就能获得较快的更新速度了。
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
这行第一个字符是#表示该行已经被注释,将不会被读取,这一行的意思是指定一个baseurl(源的镜像服务器地址)。
baseurl通常有以下四种格式,如下:
baseurl= /centos/6.6/os/x86_64/
使用http协议镜像服务器地址
baseurl= ftp://ftp./centos/6.6/os/x86_64/
使用ftp协议镜像服务器地址
baseurl= rsync://mirror.zol.co.zw/centos/
使用rsync镜像服务器地址
baseurl= file:///ilanni/yum/
使用本机的镜像服务器地址
其中前两种是我们使用最多的。有关这个我们可以参考centos官网给出的参考,如下:
该选项表示在这个repo文件中启用这个软件源,默认该选项可以不写。但是如果enabled的值为0,则表示禁用这个软件源。
注意:一个repo文件中可以定义多个软件源。
gpgcheck=1
该选项表示对通过该软件源下载的rpm包进行gpg校验,如果gpgcheck的值为0表示不进行gpg校验。
gpgkey= file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
该选项定义用于校验的gpg密钥文件。
通过以上这个repo文件的说明,相信各位会觉得,其实centos的repo文件真是很简单。有了一个初步的认识了之后,我们就可以进行下面的实验了。
我们现在要求在公司内网搭建一个yum源。该yum源需要配置两个源:一个是centos的光盘镜像源,一个是特殊rpm软件的镜像源,并且该yum源是通过http进行访问。
此次实验:yum服务器192.168.1.247 centos,客户端192.168.1.248 centos。
四、yum服务器端配置
要达到以上要求,我们首先要搭建yum服务器,并且在该服务器配置web服务器。
在此web服务器我们使用的是apache,当然使用nginx也是可以的。
4.1 配置web服务器
在yum服务器上,我们现在直接使用yum安装apache。如下:
yum -y install httpd
当然你也可以使用源码方式安装apache,有关apache的源码安装可以参考《》。
apache安装完毕后,我们来启动apache。如下:
/etc/init.d/httpd start
wget http://192.168.1.247
通过上图,我们可以很明显的看到apache服务器已经正常启动。
4.2 安装createrepo
createrepo是什么?createrepo是linux下创建仓库的软件包。create是创建的意思,repo是repository的缩写,是仓库的意思。
只有安装createrepo这个软件,才能在yum服务器创建软件仓库。
createrepo的安装很简单,我们现在通过yum进行安装,如下:
yum -y install createrepo
createrepo安装完毕后,我们就可以创建repo仓库了。
4.3 光盘镜像
把本地下载的光盘镜像复制到yum服务器上,我们在此是通过xftp工具复制的,如下:
创建软件源所在的位置,如下:
mkdir -p /var/www/html/yum
ll /var/www/html/yum/
创建光盘挂载的目录,如下:
mkdir /iso
mount -o loop CentOS-6.6-x86_64-minimal.iso /iso/
复制到光盘下的所有文件到/var/www/html/yum/目录下,如下:
cp -rv /iso/* /var/www/html/yum/
现在我们访问下该目录,看看能不能正常显示,如下:
wget http://192.168.1.247/yum
通过上图我们可以很明显的看到,目前该目录是可以被正常访问的。
注意:在此我们没有创建yum数据库和信息索引文件,是因为光盘已经有yum数据库和信息索引文件,我们不需要再通过createrepo命令在进行。其实yum的数据库和信息索引文件,都在repodata文件夹下。如下:
为了光盘镜像实验的效果,我们在此以光盘镜像软件包中curl软件为例。如下:
ll |grep curl
4.4 特殊软件镜像
在前面我们还要求一个特殊的yum源用来存放特殊软件的,在此我们以lrzsz这个软件为例。
该yum源存放的位置/var/www/html/ilanni/目录下,然后把lrzsz这个软件的rpm包放在/var/www/html/ilanni/目录下,如下:
mkdir -p /var/www/html/ilanni
cp /var/cache/yum/x86_64/6/base/packages/lrzsz-0.12.20-27.1.el6.x86_64.rpm /var/www/html/ilanni/
ll /var/www/html/ilanni/
现在我们来创建该特殊yum源的yum数据库和信息索引文件,切换到/var/www/html/ilanni/目录下,执行createrepo命令,如下:
createrepo ./
tree repodata/
现在我们访问下该目录,看看能不能正常显示,如下:
wget http://192.168.1.247/ilanni
通过上图我们可以很明显的看到,目前该目录是可以被正常访问的。
以上的所有配置都是在yum服务器上进行的,现在我们来切换到yum客户端上进行操作。
五、yum客户端配置
yum客户端的操作就简单了很多,我们只需要修改客户端的repo文件即可。
进入/etc/yum.repos.d/目录,备份原有的repo文件,如下:
rename .repo .repo.bak *.repo
然后在该目录下,创建一个新的repo文件ilanni.repo,内容如下:
name=centos6
baseurl=http://192.168.1.247/yum/
gpgcheck=0
name=ilanni
baseurl=http://192.168.1.247/ilanni/
gpgcheck=0
注意:该文件名可以变,但是后缀一定是.repo。
repo文件修改完毕后,我们来进行相关测试。
安装curl软件,如下:
yum -y install curl
安装lrzsz软件,如下:
yum -y install lrzsz
通过以上测试,我们可以很明显的看到客户端已经从yum服务器下载我们所需要的软件包。
注意:如果客户端yum安装软件包时,提示找不到该软件。强烈建议,在客户端上执行yum clean all和yum list命令。
其中yum clean all表示清除yum源缓存,yum list表示列出所有的软件包。
以上就是我们在内网搭建yum源的步骤。
六、保存yum安装的软件包
在我们使用yum进行安装软件时,安装完毕后会自动把软件包删除。
为了保存yum安装的软件包,我们需要修改yum的配置文件yum.conf,把keepcache修改为1即可。如下:
vi /etc/yum.conf
cachedir表示rpm包的缓存位置。
七、更新rpm包
在我们搭建完毕内网yum源后,会经常遇到这两种情况。一是软件版本的更新,二是新增软件。
无论遇到以上那种情况,我们都需要先删除原来的yum服务器的yum数据库和信息索引文件,然后通过createrepo命令重新创建yum数据库和信息索引文件。
在此我们以新增软件为例,该软件为lftp。
cp /var/cache/yum/x86_64/6/base/packages/lftp-4.0.9-1.el6_5.1.x86_64.rpm /var/www/html/ilanni/
ll /var/www/html/ilanni/
rm -fr /var/www/html/ilanni/repodata/
createrepo /var/www/html/ilanni/
现在我们再来切换到客户端上进行操作,如下:
yum clean all
yum list |grep lftp
yum -y install lftp
通过上图,可以很明显的看出客户端已经安装lftp软件了。
版权声明:本文内容由互联网用户自发贡献,本社区不拥有所有权,也不承担相关法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件至: 进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容。
用云栖社区APP,舒服~
【云栖快讯】红轴机械键盘、无线鼠标等753个大奖,先到先得,云栖社区首届博主招募大赛9月21日-11月20日限时开启,为你再添一个高端技术交流场所&&
业内领先的面向企业的一站式研发提效平台,通过项目流程管理和专项自动化提效工具,能够很好地支持互联网敏捷项目的快速...
为您提供简单高效、处理能力可弹性伸缩的计算服务,帮助您快速构建更稳定、安全的应用,提升运维效率,降低 IT 成本...
MaxCompute75折抢购
Loading...用reposync 同步YUM源到本地,搭建本地YUM源服务器
之前总结的搭建本地yum源是通过rsync直接同步其他在线的yum源,例如清华大学大YUM源,但是类似的阿里云的yum源,因为其不支持rsync所以不能进行同步,
同样的,想要同步其他一些官方的YUM源,也要对方支持rsync才能支持同步,而有很希望安装的YUM源并不支持rsync,这样怎么办呢?
因上述原因我想到了另一种思路去同步&所有&我想同步的YUM源,并且搭建成本地可用的YUM源,下面记录下我的思路。
1、首先预备好一台nginx或者apache的server来做本地的YUM源(我喜欢nginx),该操作可以去参考&YUM本地源搭建,且Rsync同步官方&的操作。
2、搭建好的本地YUM源server后,再下载想要同步YUM源的repo文件。
wget -O /etc/yum.repos.d/CentOS-Base.repo/repo/Centos-6.repo
3、安装几个工具,默认的centos是没有安装,yum installcreaterepo yum-utils -y
安装这两个工具主要使用 createrepo 和reposync 这两个命令
4、上面的操作完毕后,执行命令yum repolist
其中&仓库标识:中的名字是我们下面将要用到的
5、例如我想要把HDP-2.2作为本地YUM源(这是我在做Ambari + hadoop实验的yum源,因为该源可能被很多台hadoop datanode端用到所有,搭建本地yum源会节约大量的出口带宽
提高工作效率。)那么我执行如下命令行
[root@localhosttmp]# reposync -r HDP-2.2
如下开始自动更新yum源到本地文件夹
当然在这一步,我们可以参考下reposync的帮助,直接把想要同步的yum源直接定位到希望下载的某个目录,
例如使用参数 -p
也可以使用 -d 来删除本地老旧,yum源已经不存的安装包。
6、当通过reposync命令同步yum源到想要指定的路径之下后,然后使用createrepo命令创对该路径下的rpm包创建为本地的YUM仓库
6.1、到这里的时候,其实想要的yum本地仓库已经算是制作完毕, 为了简化工作量,我们可以把上面的操作制作成bash脚本
思路如下:
reposync自动同步想要的yum 源到指定的路径,因为每次同步后,内容可能有所改变,所以需要重新执行createrepo命令重新创建YUM仓库。
7、上面的操作完毕后,就是在client端制作repo文件并指向我们本地的YUM源了,因为我们同步YUM源的时候,可能会忽略掉对方的gpgkey,那么记得&gpgcheck=0&
以上是思路总结,暂时没有时间和精力做这样的本地YUM源,遇到的时候再参考此思路做吧。设置CentOS yum源及第三方资源库
CentOS yum的使用方法yum是什么yum = Yellow dog Updater, Modified主要功能是更方便的添加/删除/更新RPM包,它能自动解决包的倚赖性问题,它能便于管理大量系统的更新问题。yum特点可以同时配置多个资源库(Repository)简洁的配置文件(/etc/yum.conf自动解决增加或删除rpm包时遇到的倚赖性问题使用方便保持与RPM数据库的一致性yum安装CentOS自带(yum-*.noarch.rpm)#rpm -ivh yum-*.noarch.rpm在第一次启用yum之前首先需要导入系统的RPM-GPG-KEY:#rpm --import /usr/share/doc/centos-release-5(4)/RPM-GPG-KEY-CentOS-5(4)yum指令注:当第一次使用yum或yum资源库有更新时,yum会自动下载所有所需的headers放置于/var/cache/yum目录下,所需时间可能较长。rpm包的更新检查可更新的rpm包#yum check-update更新所有的rpm包#yum update更新指定的rpm包,如更新kernel和kernel source#yum update kernel kernel-source大规模的版本升级,与yum update不同的是,连旧的淘汰的包也升级#yum upgraderpm包的安装和删除安装rpm包,如xmms-mp3#yum install xmms-mp3删除rpm包,包括与该包有倚赖性的包#yum remove licq注:同时会提示删除licq-gnome,licq-qt,licq-textyum暂存(/var/cache/yum/)的相关参数清除暂存中rpm包文件#yum clean packages清除暂存中rpm头文件#yum clearn headers清除暂存中旧的rpm头文件#yum clean oldheaders清除暂存中旧的rpm头文件和包文件#yum clearn 或#yum clearn all注:相当于yum clean packages + yum clean oldheaders包列表列出资源库中所有可以安装或更新的rpm包#yum list列出资源库中特定的可以安装或更新以及已经安装的rpm包#yum list mozilla#yum list mozilla*注:可以在rpm包名中使用匹配符,如列出所有以mozilla开头的rpm包列出资源库中所有可以更新的rpm包#yum list updates列出已经安装的所有的rpm包#yum list installed列出已经安装的但是不包含在资源库中的rpm包#yum list extras注:通过其它网站下载安装的rpm包rpm包信息显示(info参数同list)列出资源库中所有可以安装或更新的rpm包的信息#yum info列出资源库中特定的可以安装或更新以及已经安装的rpm包的信息#yum info mozilla#yum info mozilla*注:可以在rpm包名中使用匹配符,如列出所有以mozilla开头的rpm包的信息列出资源库中所有可以更新的rpm包的信息#yum info updates列出已经安装的所有的rpm包的信息#yum info installed列出已经安装的但是不包含在资源库中的rpm包的信息#yum info extras注:通过其它网站下载安装的rpm包的信息搜索rpm包搜索匹配特定字符的rpm包#yum search mozilla注:在rpm包名,包描述等中搜索搜索有包含特定文件名的rpm包#yum provides realplay增加资源库例如:增加rpm.livna.org作为资源库安装Livna.org rpms GPG key#rpm --import http://rpm.livna.org/RPM-LIVNA-GPG-KEY检查GPG Key# rpm -qa gpg-pubkey*显示Key信息#rpm -qi gpg-pubkey-a109b1ec-3f6e28d5(注:如果要删除Key,使用#rpm -e gpg-pubkey-a109b1ec-3f6e28d5)yum常用的命令# yum install xxx&&&&&&&&&&& 安装xxx软件# yum info xxx&&&&&&&&&&&&&&& 查看xxx软件的信息# yum remove xxx&&&&&&& 删除软件包# yum list&&&&&&&&&&&&&&&&&&&&&&& 列出软件包# yum clean&&&&&&&&&&&&&&&&&&& 清除缓冲和就的包# yum provides xxx&&&&&&& 以xxx为关键字搜索包(提供的信息为关键字)# yum search xxx&&&&&&&&&& 搜索软件包(以名字为关键字)# yum groupupdate xxx# yum grouplist xxx# yum groupremove xxx这三个都是一组为单位进行升级 列表和删除的操作。。比如 &Mysql Database&就是一个组会同时操作相关的所有软件包;# yum update&&&&&&&&&&&&&&& 系统升级# yum list available&&&&&&& 列出所有升级源上的包;# yum list updates&&&&&&&& 列出所有升级源上的可以更新包;# yum list installed&&&&&&&& 列出已经安装的包;# yun update kernel&&&&&& 升级内核;yum常用的源(1) 自动选择最快的源由于yum中有的mirror速度是非常慢的,如果yum选择了这个mirror,这个时候yum就会非常慢,对此,可以下载fastestmirror插件,它会自动选择最快的mirror:#yum install yum-fastestmirror配置文件:(一般不用动)/etc/yum/pluginconf.d/fastestmirror.conf你的yum镜像的速度测试记录文件:/var/cache/yum/timedhosts.txt(2)使用图形界面的yum如果觉得命令行的yum不方便,那么可以使用图形化的yumex,这个看起来更方便,因为可以自由地选择软件仓库:#yum install yumex然后在系统工具中就可以看到yum extender了。实际上系统自带的“添加/删除程序“也可以实现图形化的软件安装,但有些yumex的功能它没有。 取得最新有效源可以访问下面地址获得,对于不同网络,这两个都表现很好。网易:中科大:CentOS默认自带CentOS-Base.repo源,但官方源中去除了很多有版权争议的软件,而且安装的软件也不是最新的稳定版。Fedora自带的源中也找不到很多多媒体软件,如果需要安装,必需先添加其他源,如RPMFusion和RPMForge等第三方软件库。请针对不同的版本下载相应的包。3rd Party Repositories(第三方资源库)WARNING: These repositories are not provided nor supported by CentOS. They are listed in a 'catch as catch can' order, and being listed earlier does not imply any particular merit to a given repository. The CentOS project exercises no editorial control over the assertions of computability made by these sites. If something from them breaks, you get to keep the pieces. Some of the repos, such as RPMforge, ELRepo, ATrpms, EPEL, and RPMfusion have their own mailing lists for support issues with their packages.NOTE: If you are considering using a 3rd Party Repository, then you should seriously consider how to prevent unintended 'updates' from these side archives from over-writing some core part of CentOS. One approach is to only enable these archives from time to time, and generally leave them disabled.Security warning: The rpmforge-release package imports GPG keys into your RPM database. As long as you have verified the md5sum of the key injection package, and trust Dag, et al., then it should be as safe as your trust of them extends.[主要的发行repo源]RPMforge/RepoforgeRepoforge is a project that maintains RPM packages for Red Hat Enterprise Linux (RHEL), CentOS and Scientific Linux. It consists of a set of repositories compatible with various RHEL versions. This project is a fusion of or supported by various other projects and numerous independent RPM packagers. They provide over 5000 packages for SL, including wine, vlc, mplayer, xmms-mp3, and other popular media tools.RPMForge是CentOS系统下的软件仓库,拥有4000多种的软件包,被CentOS社区认为是最安全也是最稳定的一个软件仓库。主页:RPMForge下载地址:ELRepoThe Community Enterprise Linux RepositoryELRepo is a community repository for Enterprise Linux distributions (e.g, Red Hat Enterprise Linux (RHEL), CentOS, Scientific Linux). ELRepo currently focuses on hardware related packages to boost your experience with Enterprise Linux. For example, this includes filesystem, graphics, hardware monitoring, network, sound and webcam drivers. All our packages are built against the RHEL kernel and are compatible with other clone distributions who maintain compatibility with the RHEL kernel (e.g, CentOS, Scientific Linux). 主页:EPELEPEL,即Extra Packages for Enterprise Linux,是由 Fedora 社区创建维护,为 RHEL 及衍生发行版如 CentOS、Scientific Linux 等提供高质量软件包的项目。EPEL中含有大量的软件,对官方标准源是一个很好的补充。EPEL (Extra Packages for Enterprise Linux& ) is a Fedora Special Interest Group that creates, maintains, and manages a high quality set of additional packages for Enterprise Linux, including, but not limited to, Red Hat Enterprise Linux (RHEL), CentOS and Scientific Linux (SL).EPEL packages are usually based on their Fedora counterparts and will never conflict with or replace packages in the base Enterprise Linux distributions. EPEL uses much of the same infrastructure as Fedora, including buildsystem, bugzilla instance, updates manager, mirror manager and more.主页:RemiAlthough a small private repo, it is used by many as additional repo next to EPEL. The owner maintains various packages for the Fedora and EPEL repositories (and also some for RPMFusion).Remi源对于不想编译最新版的linux使用者,因为Remi源中的软件几乎都是最新稳定版。或许您会怀疑它不稳定?不用担心,这些都是Linux骨灰级的玩家编译好放进源里的,他们对于系统环境和软件编译参数的熟悉程度毋庸置疑。它目前正在成为许多人的首选源。主页:[其它的发行repo源]这些源对日常大部分软件的管理维护基本上用不到,但有不常见的软件能在此找到,如桌面、下载等。或基于rhel的发行版本的源(不一定兼容所有版本)。RPMFusion如果您现在正在使用Fedora15,对RPMFusion一定不陌生吧,各种音频软件如MPlayer在标准源中是没有的,一般先安装RPMFusion源,之后就可以放便地yum install各种需要的软件啦。RPM Fusion provides software that the Fedora Project or Red Hat doesn't want to ship. That software is provided as precompiled RPMs for all current Fedora versions and Red Hat Enterprise Linux 5; you can use the RPM Fusion repositories with tools like yum and PackageKit. RPM Fusion is a merger of Dribble, Freshrpms, and L our goal is to simplify end-user experience by grouping as much add-on software as possible in a single location.CentOS官方说RPMFusion软件库里面的软件稳定性不如rpmforge,安装使用过程如下:RHEL 6/CentOS 6 :su -c ’rpm -Uvh http://download1.rpmfusion.org/free/el/updates/testing/6/i386/rpmfusion-free-release-6-0.1.noarch.rpm http://download1.rpmfusion.org/nonfree/el/updates/testing/6/i386/rpmfusion-nonfree-release-6-0.1.noarch.rpm’其他发行版本请详见:http://rpmfusion.org/Configuration主页:KBS-ExtrasThis site (by a CentOS team member) provides a rebuild of selected packages from the archive formerly known as Fedora Extras but patched as needed for CentOS, as well as number of other packages. This repository is available at homepage and has a reputation for being stable and safe. Current CentOS 5 packages are in -testing repos only, the primary repos being empty. 主页:ATrpmsThis repository provides many bleeding-edge applications and media utilities such as myth-tv. This repository is available at http://atrpms.net/This repository's CentOS 4 and earlier archive replaces system packages with versions which are usually later than those which Base CentOS ships, and may cause stability issues. Use at your own risk.The CentOS 5/RHEL 5 repository from atrpms.net is safe to use, if you only use the stable version. Packages in there do not overwrite system packages.If you also enable testing and bleeding sub-trees from, ATrpms, you are in uncharted waters again - these two do overw testing however, has been labeled a misnomer by Axel Thimm and is pretty much required to get MythTV and a lot of other ATrpms multimedia packages to work. ATrpms testing has actually been tested and is analogous to centosplus.主页:LinuxTECH.NETThe LinuxTECH.NET repos are a set of small but growing personal repos for EL6 compatible distros, created for personal use, but also accessible publicly on an &AS IS& basis. The main focus of these repos is audio/video related packages with an emphasis on wide support of codecs and as many optional features enabled as possible in all packages. Apart from audio/video related packages you will also find a few other unusual server and desktop related packages that no other EL compatible repo has.主页:PUIAS LinuxPUIAS is a clones also based on the sources from RHEL and a project of the computing staff of Princeton University and the Institute for Advanced Study. They offer additional repos. The Addons repository contains additional packages not included in a stock Red Hat distribution. The Computational repository also includes additional packages, however, these packages are specific to scientific computing. The Unsupported repository is a place where one time packages are put, they are unsupported and may change frequently.主页:[以下是部分软件(第三方)源]Samba 3The SerNet Samba 3 Repository - German site with Samba 3 packages for Centos 3, 4, and 5Repo configs for 3, 4, and 5 are available. Some users have reported success with these packages but caution is advised. 主页:第三方Java应用JPackage Repository--&The JPackage Project has two primary goals:To provide a coherent set of Java software packages for Linux, satisfying all quality requirements of other applications.To establish an efficient and robust policy for Java software packaging and installation. We focus on free and open source software whenever possible. For convenience, we also provide non-free packages without the restricted source code. Our RPMs are generic in that they should work on any RPM based Linux distribution (Mandrake, Red Hat, SuSE, others). Other packaging format suggestions are welcome too. & 主页:Apache+php+mysql+nginx新版本源Jason Litka - Utter Ramblings Repository - (See /yum-repository/) Updated web stack and other applications for EL4 and EL5 that will replace core packages. Includes apr, apr-util, freetds, httpd, libmcrypt, mhash, mod_evasive, mod_perl, mod_python, mod_security, mysql, mysqlclient10, mysqlclient14, pcre, perl-BSD-Resource, php, php-apc, php-eaccelerator, php-memcache, php-pear, php-xcache, subversion, tidy. Suggest caution if using this repo due to replacement of core packages. 注:在没有知道remi源之前,在做新的网站系统时用的这个源,与remi源同用时有冲突。主页:在此不一列举,其它还包括Google、Percona、Postgresql、FireFox、Adobe等都有相关源,更多请留意其主页。如何使用各种源以上主要源对CentOS等系统完全兼容,但各软件库之间并不能保证完全兼容没有冲突。如果您需要使用以上源,需要安装yum-priorities插件。安装yum-priorities插件后,您可以给各个源设置优先级priority。一般设置官方标准源优先级为1,最高,第三方推荐&10。priority=N (N为1到99的正整数,数值越小越优先)[base], [addons], [updates], [extras] … priority=1[CentOSplus],[contrib] … priority=2其他第三的软件源为:priority=N (推荐N&10)在remi.repo中和epel.repo中添加priority设置即可使用。#vim CentOS-Base.repo[base]name=CentOS-$releasever - Basemirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6priority=1#released updates……# lsCentOS-Base.repo CentOS-Media.repo& epel-testing.repo CentOS-Debuginfo.repo epel.repo remi.repo编辑 remi.repo 将[remi] 中的 enabled=0 改成 enabled=1 来启用 remi 源。[repo源控制]列出、验证系统中的源:# yum repolist临时禁止更新、使用某一或多个源:# yum --disablerepo=remi update# yum --disablerepo=fedora-devel --disablerepo=fedora-updates-testing list# yum --disablerepo=&*& --enablerepo=google-chrome list available如果要禁止某一源,可在其配置文件中修改:在目录'/etc/yum.repos.d/'下将相关源字段(有多个)的'enabled'由'1'改为'0'。如果也要临时启用被禁止的源:yum --enablerepo=some-disabled-repository install some-package彻底移除某一个源:找到相关源的rpm包安装记录:rpm -qa |grep -i repo-name删除该软件包:rpm -e some-repository-rpm-package也可以删除或移出repo文件(如果是手动建立而非通过包安装):rm|mv /etc/yum.repos.d/kde.repo# 导入相关源的gpg key.# rpm –import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6# rpm –import /etc/pki/rpm-gpg/RPM-GPG-KEY-remi更多源信息可参考:Yum使用过程问题集yum update 卡住现象 不响应(not respond)主要是停留在这两处时:Loaded plugins: fastestmirrorLoading mirror speeds from cached hostfile可能是本地dns的问题,看下解析有没有问题:nslookup|如果解析没有问题,可手动清理下其缓存:rm -f /var/cache/yum/timedhosts.txt如果还不能起作用的话,可以重建一下rpm数据库:rm -f /var/lib/rpm/__*rpm --rebuilddb -v -v& &yum clean all同时可改一下‘/etc/yum.conf’中的参数:debugelevel=1errorlevel=1timeout=1The timeout is standard 30 seconds. So if a repository does not respond, the error takes 30 seconds to appear. Also try using yum without the plugins (like fastest mirror and priorities) with the option --noplugins. Now starting yum again should give you more info faster. Test with:yum --verbose --noplugins info也可将yum中的自动查找最快源的插件禁用,前提是主配置文件里已经加上源主机。即编辑'/etc/yum/pluginconf.d/fastestmirror.conf'文件,将‘enabled’项由'1'置为'0',再试看能否成功。将本地光盘/iso作为yum安装源这种情况多见于上网不方便,或使用了rhel发行版本而又需要安装软件,下面示例从rhel 6.x的dvd iso做成本地源,然后通过yum进行软件的安装。方法一:将iso挂载到目录并做成repo源创建挂载点mkdir /mnt/iso挂载iso到上述目录mount -o loop rhel-6.x.iso /mnt/iso/创建repository:[rhel-local-dvd]name=Red Hat OS DVDbaseurl=file:///mnt/iso/Serverenabled=1gpgcheck=0清空与更新yum缓存yum clean all && yum update方法二:使用localinstall方式安装具体软件yum localinstall /mnt/iso/Server/gcc-(versiom).rpm当然也可以直接安装具体软件,如果没有什么依赖的话。方法三:Create a repository需要createrepo软件包,通过源安装或rpm包。rpm -ivh createrepo-version.rpm将光盘或iso中的内容复制到目录'/var/ftp/pub',创建repo库createrepo -v /var/ftp/pub/或cd &/var/ftp/pub/ && createrepo . && yum clean all编辑repo源配置文件vim /etc/yum.repos.d/base.repo[base]name=RHEL Local Server Repobaseurl=http://ipaddr/pub/&enabled=1gpgcheck=0这样也可以为远程机器提供内部网络安装源。}

我要回帖

更多关于 createrepo yum源 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信