摘要:Centos5.0 yum的使用與詳細配置
yum = Yellow dog Updater, Modified
yum 的配置文檔在的 /etc/yum中
相關文件有yum.conf
[root@test56 uc]# ls /etc/yum.repos.d/
CentOS-Base.repo CentOS-Media.repo
兩紅色配置文件就是用來yum安裝、更新rpm包的
CentOS-Base.repo是外網更新站點
CentOS-Media.repo是本地媒介更新點
vi CentOS-Base.repo
[base]
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=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
#released updates
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
#packages used/produced in the build but not released
[addons]
name=CentOS-$releasever - Addons
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=addons
#baseurl=http://mirror.centos.org/centos/$releasever/addons/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
由於為國外站點,更新、安裝速度慢,下面是國外鏡像點
etc/yum.repos.d/CentOS-Base.repo
CentOS5 yum 國內鏡像服務器 配置文件:[base]
name=CentOS-5 - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever5&arch=$basearch&
repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
baseurl=http://mirror.be10.com/centos/$releasever/os/$basearch/
$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5#released updates
[update]
name=CentOS-5 - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=updates
baseurl=http://mirror.be10.com/centos/$releasever/updates/$basearch/
http://ftp.hostrino.com/pub/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5#packages used/produced in the build but not released
[addons]
name=CentOS-5 - Addons
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=addons
baseurl=http://mirror.be10.com/centos/$releasever/addons/$basearch/
http://ftp.hostrino.com/pub/centos/$releasever/addons/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5#additional packages that may be useful
[extras]
name=CentOS-5 - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=extrasbaseurl=http://mirror.be10.com/centos/$releasever/extras/$basearch/
http://ftp.hostrino.com/pub/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-5 - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=centosplus
baseurl=http://mirror.be10.com/centos/$releasever/centosplus/$basearch/
http://ftp.hostrino.com/pub/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5#contrib - packages by Centos Users
[contrib]
name=CentOS-5 - Contrib
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=contrib
baseurl=http://mirror.be10.com/centos/$releasever/contrib/$basearch/
http://ftp.hostrino.com/pub/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
配置檔案參數的說明:
gpgchkeck= 有1和0兩個選擇,分別代表是否是否進行gpg校驗,如果沒有這一項,默認好像也是檢查的。
enabled=0 表示不啟用此更新庫
name,是對repository的描述,支持像 ;
baseurl是伺服器設置中最重要的部分,只有設置正確,才能從上面獲取軟體。
yum可以使用gpg對包進行校驗,確保下載包的完整性,所以我們先要到各個repository站 點找到gpg key
如果想讓yum在光碟內更新RPM包,做如下設置
默認系統會直接找到CentOS-Base.repo(是外網更新站點)做更新、安裝
我們可以修改其檔案名讓系統找不到此檔,然後找
CentOS-Media.repo是本地媒介更新點
做更新、安裝,這樣速度會快的多
mv CentOS-Base.repo CentOS-Base.repo.bak
啟用CentOS-Media.repo ,做如下配置
# mkdir /dvd
# mount /dev/cdrom /dvd
vi CentOS-Media.repo
[c5-media] ;這個沒有啟用
name=CentOS-$releasever - Media
baseurl=file:///media/CentOS/
file:///media/cdrom/
file:///media/cdrecorder/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-beta
[dvd]
name=dvd
baseurl=file:///dvd
gpgcheck=0 ;不檢查gpgkey
這樣就可以使用yum來更新了
yum使用方法
查看一套裝軟體
yum list | grep mysql ;查看mysq套裝軟體
yum update
yum install mysq ;安裝mysql套裝軟體
以上文章來來源: http://blog.163.com/herod_xiao/