yum的配置文件yum.conf详解
说明:经过网上抄袭和自己的总结加实验,非常详细,可留作参考。
yum的配置一般有两种方式: 一种是直接配置/etc目录下的yum.conf文件, 另外一种是在/etc/yum.repos.d目录下增加.repo文件。
一、yum的配置文件yum.conf详解
01.$ cat /etc/yum.conf02. 03.[main]04.cachedir=/var/cache/yum #yum下载的RPM包的缓存目录05.keepcache=0 #缓存是否保存,1保存,0不保存。06.debuglevel=2 #调试级别(0-10),默认为2(具体调试级别的应用,我也不了解)。07.logfile=/var/log/yum.log #yum的日志文件所在的位置08.exactarch=1 #在更新的时候,是否允许更新不同版本的RPM包,比如是否在i386上更新i686的RPM包。09.obsoletes=1 #这是一个update的参数,具体请参阅yum(8),简单的说就是相当于upgrade,允许更新陈旧的RPM包。10.gpgcheck=1 #是否检查GPG(GNU Private Guard),一种密钥方式签名。11.plugins=1 #是否允许使用插件,默认是0不允许,但是我们一般会用yum-fastestmirror这个插件。12.installonly_limit=3 #允许保留多少个内核包。13.exclude=selinux* #屏蔽不想更新的RPM包,可用通配符,多个RPM包之间使用空格分离。14.# This is the default, if you make this bigger yum won't see if the metadata15.# is newer on the remote and so you'll "gain" the bandwidth of not having to16.# download the new metadata and "pay" for it by yum not having correct17.# information.18.# It is esp. important, to have correct metadata, for distributions like19.# Fedora which don't keep old packages around. If you don't like this checking20.# interupting your command line usage, it's much better to have something21.# manually check the metadata once an hour (yum-updatesd will do this).22.# metadata_expire=90m23.# PUT YOUR REPOS HERE or IN separate files named file.repo24.# in /etc/yum.repos.d二、*.repo文件详解 什么是repo文件? repo文件是Fedora中yum源(软件仓库)的配置文件,通常一个repo文件定义了一个或者多个软件仓库的细节内容,例如我们将从哪里下载需要安装或者升级的软件包,repo文件中的设置内容将被yum读取和应用!
我们以一份系统自带的repo文件做为实例来探讨(Fedora和redhat是一致的)(#号后面是我加的注释):
01.[fedora] #方括号里面的是软件源的名称,将被yum取得并识别02. 03.name=Fedora $releasever - $basearch #这里也定义了软件 仓库的名称,通常是为了方便阅读配置文件,一般没什么作用,$releasever变量定义了发行版本,通常是8,9,10等数字,$basearch变 量定义了系统的架构,可以是i386、x86_64、ppc等值,这两个变量根据当前系统的版本架构不同而有不同的取值,这可以方便yum升级的时候选择 适合当前系统的软件包,以下同……04.failovermethod=priority #failovermethod 有两个值可以选择,priority是默认值,表示从列出的baseurl中顺序选择镜像服务器地址,roundrobin表示在列出的服务器中随机选择05.exclude=compiz* *compiz* fusion-icon* #exclude这个选项是后来我自己加上去的,用来禁止这个软件仓库中的某些软件包的安装和更新,可以使用通配符,并以空格分隔,可以视情况需要自行添加06.#baseurl=http://download.fedoraproject.org/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/07.#上面的一行baseurl第一个字符是'#'表示该行已经被注释,将不会被读取,这一行的意思是指定一个baseurl(源的镜像服务器地址)08.#mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-$releasever&arch=$basearch09.#上面的这一行是指定一个镜像服务器的地址列表,通常是开启的,本例中加了注释符号禁用了,我们可以试试,将$releasever和$basearch替换成自己对应的版本和架构,例如10和i386,在<a href="http://www.it165.net/edu/ewl/" target="_blank" class="keylink">浏览器</a>中打开,我们就能看到一长串镜可用的镜像服务器地址列表。10.选择自己访问速度较快的镜像服务器地址复制并粘贴到repo文件中,我们就能获得较快的更新速度了,格式如下baseurl所示:11.baseurl=12.ftp://ftp.sfc.wide.ad.jp/pub/<a href="http://www.it165.net/os/oslin/" target="_blank" class="keylink">Linux</a>/Fedora/releases/10/Everything/i386/os13.http://ftp.chg.ru/pub/<a href="http://www.it165.net/os/oslin/" target="_blank" class="keylink">Linux</a>/fedora/linux/releases/10/Everything/i386/os14.http://ftp.yz.yamagata-u.ac.jp/pub/linux/fedora/linux/releases/10/Everything/i386/os15.http://mirror.nus.edu.sg/fedora/releases/10/Everything/i386/os16.http://mirror.yandex.ru/fedora/linux/releases/10/Everything/i386/os17.http://ftp.twaren.net/Linux/Fedora/linux/releases/10/Everything/i386/os18.http://ftp.itu.edu.tr/Mirror/Fedora/linux/releases/10/Everything/i386/os19. 20.enabled=1 #这个选项表示这个repo中定义的源是启用的,0为禁用21.gpgcheck=1 #这个选项表示这个repo中下载的rpm将进行gpg的校验,已确定rpm包的来源是有效和安全的22.gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch #定义用于校验的gpg密钥,就是数位签章的公钥档所在位置!23. 24.##以下的软件仓库基本上用不到,选项含义同上25.[fedora-debuginfo]26.name=Fedora $releasever - $basearch - Debug27.failovermethod=priority28.#baseurl=http://download.fedoraproject.org/pub/fedora/linux/releases/$releasever/Everything/$basearch/debug/29.mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-debug-$releasever&arch=$basearch30.enabled=031.gpgcheck=132.gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch33. 34.[fedora-source]35.name=Fedora $releasever - Source36.failovermethod=priority37.#baseurl=http://download.fedoraproject.org/pub/fedora/linux/releases/$releasever/Everything/source/SRPMS/38.mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-source-$releasever&arch=$basearch39.enabled=040.gpgcheck=141.gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch下面看看rhel5.8自带的repo文件
1.[root@10gasm yum.repos.d]# cat rhel-debuginfo.repo2.[rhel-debuginfo]3.name=Red Hat Enterprise Linux $releasever - $basearch - Debug4.baseurl=ftp://ftp.redhat.com/pub/redhat/linux/enterprise/$releasever/en/os/$basearch/Debuginfo/5.enabled=06.gpgcheck=17.gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release我自己设置的本地yum库
1.[root@10gasm yum.repos.d]# cat dvd.repo2.[dvd]3.name=install dvd4.baseurl=file:///mnt/Server5.enabled=16.gpgcheck=0非常简单。 可以使用下面的命令查看所有的容器配置(Repository)是否生效
1.yum repolist all使用all参数列出了所有的容器配置,如果不加all只列出可用的Repository,这个可用性取决于repo配置文件中的enabled参数,如果为0,则不可用,为1则可用 例如:
1.[root@10gasm yum.repos.d]# yum repolist all2.Loaded plugins: katello, product-id, security, subscription-manager3.Updating certificate-based repositories.4.Unable to read consumer identity5.repo id repo name status6.dvd install dvd <strong>enabled:3,285</strong>7.rhel-debuginfo Red Hat Enterprise Linux 5Server - x86_64 - Debug <strong>disabled</strong>8.repolist: 3,285显示出dvd这个repository是可用的,有3285个文件,rhel-debuginfo这个库是不可用的。
如果修改rhel-debuginfo中enabled为1然后再次查看
01.[root@10gasm yum.repos.d]# yum repolist all02.Loaded plugins: katello, product-id, security, subscription-manager03.Updating certificate-based repositories.04.Unable to read consumer identity05.ftp://ftp.redhat.com/pub/redhat/linux/enterprise/5Server/en/os/x86_64/Debuginfo/repodata/repomd.xml: [Errno 4] IOError: <urlopen error (-3, 'Temporary failure in name resolution')>06.Trying other mirror.07.repo id repo name status08.dvd install dvd enabled: 3,28509.rhel-debuginfo Red Hat Enterprise Linux 5Server - x86_64 - Debug <strong>enabled: 0</strong>10.repolist: 3,285<br>yum的配置文件yum.conf详解的更多相关文章
- linux yum的配置文件 repo文件详解
linux yum的配置文件 repo文件详解 什么是repo文件?repo文件是Fedora中yum源(软件仓库)的配置文件,通常一个repo文件定义了一个或者多个软件仓库的细节内容,例如我们将从哪 ...
- Redis:默认配置文件redis.conf详解
转: Redis:默认配置文件redis.conf详解 # Redis配置文件样例 # Note on units: when memory size is needed, it is possibl ...
- Redis配置文件redis.conf详解
一.Redis配置文件redis.conf详解 # Note on units: when memory size is needed, it is possible to specifiy # it ...
- 004-mac上安装以及Nginx 配置文件nginx.conf详解
1.mac上nginx安装 安装brew:go-001-环境部署,IDEA插件 安装nginx: brew search nginx brew install nginx 当然也可以编译安装 安装完以 ...
- Nginx 配置文件 nginx.conf 详解
Nginx的配置文件nginx.conf配置详解如下: user nginx nginx; #Nginx用户及组:用户 组.window下不指定 worker_processes 8; #工作进程:数 ...
- Nginx安装及配置文件nginx.conf详解
1.安装Nginx 在安装Nginx之前,需确保系统已经安装了gcc. openssl-devel. pcre-devel和zlib-devel软件库. 下面是Nginx安装过程: wget http ...
- Nginx安装与配置文件nginx.conf详解
引用“http://ixdba.blog.51cto.com/2895551/790611” 1.安装Nginx在安装Nginx之前,需确保系统已经安装了gcc. openssl-devel. pcr ...
- 配置文件keepalived.conf详解
keepalived.conf 一个功能比较完整的keepalived 的配置文件,其配置文件keepalived.conf 可以包含三个文本块:全局定义块.VRRP 实例定义块及虚拟服务 ...
- Juno 版 Keystone 主配置文件 keystone.conf 详解
本文全面解读Icehouse发行版keystone的配置文件keystone.conf,由于从keystone提供的服务或依赖的基础设施角度入手,因此[DEFAULT]部分可能被拆分到很多子块中. 关 ...
- Redis高可用方案哨兵机制------ 配置文件sentinel.conf详解
Redis的哨兵机制是官方推荐的一种高可用(HA)方案,我们在使用Redis的主从结构时,如果主节点挂掉,这时是不能自动进行主备切换和通知客户端主节点下线的. Redis-Sentinel机制主要用三 ...
随机推荐
- Codechef FNCS Chef and Churu
Disciption Chef has recently learnt Function and Addition. He is too exited to teach this to his fri ...
- LINUX___的常用几个快捷键
linux下:ctrl-c 发送 SIGINT 信号给前台进程组中的所有进程.常用于终止正在运行的程序.ctrl-z 发送 SIGTSTP 信号给前台进程组中的所有进程,常用于挂起一个进程.ctrl- ...
- webpack入门(六)——html-webpack-plugin
html-webpack-plugin 该插件可以简化创建调用webpack bundles的html文件.在每次编译后,文件名会包含有hash值的bundles 特别有用.你可以让插件为您生成一个H ...
- live555client连多路1080P视频流花屏问题
硬件和软件环境是这种: DM8168 + linux. 解码器是DM8168自带的 视频来源: ipc通过live555做的的rtsp sever发送过来的 其它測试: 通过VLC在pc连4路1080 ...
- -webkit-transform:translate3d(0,0,0)触发GPU加速,让网页动画更流畅
前段时间,依照美拍的视频效果写了一个效果类似的网页版的动画. 电脑上安装了三种浏览器:IE.Chrome.Firefox.分别作了測试,结果显示Chrome在这方面的渲染效果最差.常常出现卡顿现象.f ...
- phpcms v9中 action="position" 和action="lists"有什么差别, 以及action 的属性和值
action值的含义: lists 内容数据(文章?)列表 relation 内容相关文章 hits 内容数据点击排行榜 category 内容栏目列表 position 内容推荐位列表
- 算法 binary search
// ------------------------------------------------------------------------------------------------- ...
- OpenCV入门笔记(一) Linux下的安装
关于OpenCV,有中文的官方站点.里面翻译了官网的教程和API等.中文官方Tutorials见这里:[Tutorials] 一.Ubuntu下的安装 能够选择直接从库里安装,或者手动编译安装,请參考 ...
- C/C++中怎样获取日期和时间
C/C++中怎样获取日期和时间摘要: 本文从介绍基础概念入手,探讨了在C/C++中对日期和时间操作所用到的数据结构和函数,并对计时.时间的获取.时间的计算和显示格式等方面进行了阐述.本文还通过大量的实 ...
- Sencha touch 初体验
一.什么是Sencha Touch? Sencha Touch是一个应用手持移动设备的前端js框架,与extjs是同一个门派的,它继承了extjs的优点和缺点.功能很强大,效果很炫丽,效率不高. 二. ...