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

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