centos7 更换yum源

来源:互联网 发布:淘宝子账号怎么添加 编辑:程序博客网 时间:2024/05/22 09:39

1、备份

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

2、下载新的CentOS-Base.repo 到/etc/yum.repos.d/

(1)aliyun源:

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


(2)163源

CentOS 5

wget http://mirrors.163.com/.help/CentOS5-Base-163.repo

CentOS 6

wget http://mirrors.163.com/.help/CentOS6-Base-163.repo

CentOS 7

wget http://mirrors.163.com/.help/CentOS6-Base-163.repo


(3)EPEL源

wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

sudo rpm -ivh epel-release-latest-7.noarch.rpm

sudo yum repolist


3、运行yum makecache生成缓存

sudo yum clean all

sudo yum makecache

sudo yum update

0 0
原创粉丝点击