怎样修改CENTOS系统的YUM源?服务器管理员们也许都有运行yum update指令来更新服务器补丁的经历。但有的服务器运行yum update会很慢,只有几K或几B每秒的速度。那么怎样才能更换为更快的yum源呢?
先备份一下旧的yum源
yum install wget -y
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
下载新的CentOS-Base.repo 到/etc/yum.repos.d/
CentOS 5
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
CentOS 6
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
CentOS 7
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
如果您的服务器连接阿里云较慢,还可以用163的yum源
http://mirrors.163.com/.help/CentOS7-Base-163.repo #centos7系统的 http://mirrors.163.com/.help/CentOS6-Base-163.repo #centos6系统的 http://mirrors.163.com/.help/CentOS5-Base-163.repo #centos5系统的
然后生成新的缓存
yum clean all
yum makecache
当然,你还可以添加epel 源,使用以下指令:
yum install epel-release
rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
# yum clean all
# yum list
EPEL (Extra Packages for Enterprise Linux)是基于Fedora的一个项目,为“红帽系”的操作系统提供额外的软件包,适用于RHEL、CentOS和Scientific Linux.