yum配置

yum的配置文件
cachedir=/var/cache/yum/$basearch/$releasever #yum下载后的缓存目录
keepcache=0 #是否缓存,0为不缓存,1为缓存
debuglevel=2
logfile=/var/log/yum.log #yum的安装日志
exactarch=1
obsoletes=1
gpgcheck=1 #默认是否进行gpg校验,0为不校验,1校验
plugins=1
installonly_limit=5
bugtracker_url=http://bugs.centos.org/set_project.php?project_id=23&ref=http://bugs.centos.org/bug_report_page.php?category=yum
distroverpkg=centos-rele
在yum配置文件中的最后一行,有以下说明,意思是:让你的repo放在/etc/yum.repo.d目录中,并且以.repo结尾

1.先切换到yum源中的配置目录cd /etc/yum.conf.d/
2.因为默认的yum源是CentOS-Base.repo,可以在此文件中修改,也可以将他修改后缀名,这里就修改后缀名吧

mv /etc/yum.conf.d/CentOS-Base.repo /etc/yum.conf.d/CentOS-Base.repo.bak
1
3.新建一个repo文件,命名为CentOS7.repo,如下配置:

[CentOS7-base] #源名称,必填
name=CentOS-$releasever-base #源描述,可以不填,但是会有提示
baseurl=file:///misc/cd/ #本地的光盘文件,可以有多个地址。必填
https://mirrors.aliyun.com/centos/7.3.1611/os/x86_64/
gpgcheck=1 #是否开启校验,在yum.conf中已经定义它默认值为1
enabled=1 #是否禁用此yum源,默认为
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#如果开启yum源包校验,则需要导入RPM公钥,此处只是在系统没有导入rpm公钥时候进行安装
#这里相当于rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

[aliyun_epel] #这是Redhat的扩展包
name=ailiyun_yum_epel
baseurl=https://mirrors.aliyun.com/epel/$releasever/x86_64
gpgkey=https://mirrors.aliyun.com/epel/RPM-GPG-KEY-EPEL-7
gpgcheck=1

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章