Windows XP Windows 7 Windows 2003 Windows Vista Windows教程綜合 Linux 系統教程
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟件教程
 Windows教程網 >> Linux系統教程 >> Linux教程 >> 如何修改CentOS yum源

如何修改CentOS yum源

日期:2017/2/7 14:33:04      編輯:Linux教程
 

解決在CentOS yum源下載慢的辦法


最近在虛擬機下面安裝了個CentOS 5.5,使用yum更新時發現下載速度異常慢。可以修改yum的配置文件,把其鏡像指向國內的服務器即可。
方案一:
# cd /etc/yum.repos.d/
# mv CentOS-Base.repo CentOS-Base.repo.bak
# wget http://docs.linuxtone.org/soft/lemp/CentOS-Base.repo
方案二:
手段修改CentOS-Base.repo文件,將baseurl設置成baseurl=http://ftp.sjtu.edu.cn/centos/5/addons/$basearch/
詳細配置如下:


[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://ftp.sjtu.edu.cn/centos/5/os/$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://ftp.sjtu.edu.cn/centos/5/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://ftp.sjtu.edu.cn/centos/5/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=extras


baseurl=http://ftp.sjtu.edu.cn/centos/5/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://ftp.sjtu.edu.cn/centos/5/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://ftp.sjtu.edu.cn/centos/5/contrib/$basearch/


gpgcheck=1


enabled=0


gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5


導入 key
# rpm –import http://ftp.sjtu.edu.cn/centos/5/os/i386/RPM-GPG-KEY-CentOS-5
運行,測試
# yum update
全部刪除臨時文件

#yum clean all
 

Copyright © Windows教程網 All Rights Reserved