1.配置網路yum源
yum配置文件在 /etc/yum.repos.d 下
http://mirrors.163.com/.help/centos.html、 網易yum源地址
更改yum源
下載配置文件 wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
將此配置文件替換/etc/yum.repos.d下 *.repo 文件
編輯配置文件
#cd /etc/yum.repos.d
#vi CentOS6-Base-163.repo
將文件中$releasever全部改成對應版本(6/6.5)
清理yum緩存
#yum clean all
將服務器軟件包信息緩存至本地,提高搜索安裝效率
#yum makecache
上面兩條命令若有報錯,一般爲配置文件更改不對,可根據錯誤信息查找更改配置文件中錯誤
完成
2.配置本地yum源
配置本地yum源需要安裝 yum-metadata-parser*.rpm 包
1、掛載系統安裝光盤
# mount /dev/cdrom /mnt/cdrom/
2、配置本地yum源
# cd /etc/yum.repos.d/
CentOS-Media.repo 是yum 本地源的配置文件
修改CentOS-Media.repo
# CentOS-Media.repo # # This repo is used to mount the default locations for a CDROM / DVD on # CentOS-5. You can use this repo and yum to install items directly off the # DVD ISO that we release. # # To use this repo, put in your DVD and use it with the other repos too: # yum --enablerepo=c5-media [command] # # or for ONLY the media repo, do this: # # yum --disablerepo=\* --enablerepo=c5-media [command] [c5-media] name=CentOS-$releasever - Media baseurl=file:///media/CentOS/ file:///mnt/cdrom/ file:///media/cdrecorder/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
在baseurl 中修改第2個路徑爲/mnt/cdrom(即爲光盤掛載點)
將enabled=0改爲1
3、禁用默認的yum 網絡源
將yum 網絡源配置文件改名爲CentOS-Base.repo.bak,否則會先在網絡源中尋找適合的包,改名之後直接從本地源讀取。
其他國內yum源列表如下:
1. 企業貢獻:
搜狐開源鏡像站:http://mirrors.sohu.com/
網易開源鏡像站:http://mirrors.163.com/
2. 大學教學:
北京理工大學:
http://mirror.bit.edu.cn (IPv4 only)
http://mirror.bit6.edu.cn (IPv6 only)
北京交通大學:
http://mirror.bjtu.edu.cn (IPv4 only)
http://mirror6.bjtu.edu.cn (IPv6 only)
http://debian.bjtu.edu.cn (IPv4+IPv6)
蘭州大學:http://mirror.lzu.edu.cn/
廈門大學:http://mirrors.xmu.edu.cn/
清華大學:
http://mirrors.tuna.tsinghua.edu.cn/ (IPv4+IPv6)
http://mirrors.6.tuna.tsinghua.edu.cn/ (IPv6 only)
http://mirrors.4.tuna.tsinghua.edu.cn/ (IPv4 only)
天津大學:http://mirror.tju.edu.cn/
中國科學技術大學:
http://mirrors.ustc.edu.cn/ (IPv4+IPv6)
http://mirrors4.ustc.edu.cn/
http://mirrors6.ustc.edu.cn/
東北大學:
http://mirror.neu.edu.cn/ (IPv4 only)
http://mirror.neu6.edu.cn/ (IPv6 only)
電子科技大學:http://ubuntu.uestc.edu.cn/